• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validating Xml ???

 
lorraine whelan
Greenhorn
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?
Thanks,
Lorraine
 
Ajith Kallambella
Sheriff
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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic