• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

well formed vs Valid documents

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i would like to know all the differences between the above two.
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The difference is actually quite simple.
A well-formed XML document is one which fully adheres to the syntax of XML. This includes things like all tags are closed, tags are properly nested (ie <a><b>blah</b></a> ) and don't cross
over (ie not <a><b>blah</a></b> ), all contentious ('<' '>' '&' ''') characters are escaped and so on.
A valid XML document is one which is well-formed, but also correctly implements its specified DTD.
Both are useful; You don't always want the overhead of DTD checking, and many XML tools are generic enough that they will work on any well-formed XML, regardless of DTD. On the other hand, it is often vital to make sure that some XML is valid against the required DTD before starting expensive processing.
Some available parsers provide validity checking, but some only check for well-formed XML. Make sure that the parser you chose does what you need.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!