• 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 ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Validating Xml ???  RSS feed

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -
Does anybody know if the Xml File is Validated while Parsing or can it also be validated when creating an XML file. And if this is so - How ?
Can this be achieved by the DTD and how is this done using Java?
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Validation is a process by which a parser ensures the structural integrity of the XML document. The DTD or the Schema reference given in the XML document is used in this process as the blueprint of the document structure. Most of the parsers available today have validating capabilities. YOu can turn the validation on/off by calling methods on the parsers before beginning the parsing.
There are several XML editors( www.xmlspy.com for example, ) that helps you create XML files that are always valid. As you might guess, these applications use a validating parser behind the screens to analyze and parse every user input to make sure it conforms with the DTD or Schema, if available.
If you would like to play with validation with DTD and Schema, I suggest you use a simple XML-enabled browser( like IE or Netscape ) to view the XML. These browsers use an in-built parser that also validates the XML if the document has a reference to a DTD/Schema. This way you can get familiarized with the validating process before using the parser from within your Java programs.
It is very important not to get confused between valid documents and well-formed documents. Whether validating or not, all parsers check for the wellformedness of the input document since, a malformed document is not considered as an XML document.
Hope that helps!
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
Happily living in the valley of the dried frogs with a few tiny ads.
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!