File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes well-formed and valid XML difference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "well-formed and valid XML difference" Watch "well-formed and valid XML difference" New topic

well-formed and valid XML difference

Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Hi All,

What is the difference between well-formed and valid XML ?

Thanks & Regards,

RR Kumaran
SCJP 1.4
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Well-formedness means that your XML structure is correct, you're not using illegal characters, etc. For example, the following document is not well-formed because the elements are not contained properly:

The validity of an XML document, however, is about the XML document complying with a given DTD or XML Schema document which describes what kind of tags are allowed, in what order, how many of them, what other elements can they contain, etc.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I agree. Here's the link:
subject: well-formed and valid XML difference
It's not a secret anymore!