Subject: re: JDom&DTD 2007-10-01 - By NP
Back 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/youraddr@(protected)
|
|