re: JDom&DTD

NP <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
i know that jdom doesn't validate the xml, but i can use the function 
build of the class SAXBuilder...i have solved the question, in this way:

code:
SAXBuilder builder = new SAXBuilder();
builder.setValidation(true);       // !!!!
builder.build(new File("myfile.xml"));

(note: in myfile.xml there is the line: <!DOCTYPE root_element SYSTEM 
"file.dtd">)

my mistake was don't write "builder.setValidation(true);"

So, if the xml doesn't respect the rules of dtd  file, Java throws a 
JDOMParseException with the explanation of the error.
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.