wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes how xml file is checked against dtd at run time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "how xml file is checked against dtd at run time" Watch "how xml file is checked against dtd at run time" New topic
Author

how xml file is checked against dtd at run time

yo nara
Ranch Hand

Joined: Apr 03, 2002
Posts: 35
suppose i have written java code for reading xml file.and xml file is created by some one else , then is that xml file checked against dtd automatically .so that i could not get error at run time or have i need to write some code for checking against dtd before parsing the java file.
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
The parser uses the DOCTYPE definition in the xml file to first determine whether the document has an associated DTD. If so, and if the validation is turned on, the parser automatically "parses the dtd" and then esures that the XML conforms to the DTD structure.
Hope that answers your question.


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
yo nara
Ranch Hand

Joined: Apr 03, 2002
Posts: 35
thanks for reply
i got error by using following methods
setValidating(true);
setErrorHandler(some class);
but now i want to check wheather the value in xml file is single byte or double byte
how should i write the schema file
Senthil Kumar Sekar
Ranch Hand

Joined: Aug 08, 2010
Posts: 45

Sorry to post in the old thread.But my question is a continuation.

If a DTD is defined and if you have say "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd", how does the parser checks if i do not have an internet connection in my pc? Does that works that way?

Could you please tell me how the DTD is validated by any parser?

Thanks.

Regards
Senthil Kumar Sekar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how xml file is checked against dtd at run time