Validation is often done at parser time by (say) a SAX parser. If you have created a document programatically and you want to validate it you've 2 choices
* output the document, then reparse it with a validating parser. So you could say use a SAXReader then setValidation(true); assuming the document you ouptput has a DTD or XML Schema reference in it * try use the JARV API to validate the document. There is an example of this in action in src/samples/validate/JARVDemo.java which uses Sun's MSV to validate a document against a DTD, XML Schema, RelaxNG etc James ------- http://radio.weblogs.com/0112098/ ----- Original Message ----- From: "Christian Holmqvist, IT, Posten" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 04, 2002 4:40 PM Subject: [dom4j-user] Validating a document Hi How do I in a simple way validate a Document that I have created. I thought (as I designed my program) that this would work.. Document docOrg = DocumentHelper.createDocument(); ... <lots of text that creates a Document that is invalid when validated with a DTD> ... Document docValidated = DocumentHelper.parseText(docOrg.asXML()); <And here I would excpect a DocumentException but nothing. Only if I make missmatching elements in the docOrg does anything happen here. But leaving required elements out does not do anything.> So is there a easy way to validate a document from the inside?? /Christian Holmqvist ------------------------- Christian Holmqvist Posten Sverige AB Posten IT 105 00 Stockholm Besöksadress: Ekensbergsvägen 113 ,Solna Tel: 08 - 781 61 48 Mobil: 070 - 985 00 28 [EMAIL PROTECTED] http://www.posten.se ------------------------------------------------------- This SF.net email is sponsored by: ApacheCon, November 18-21 in Las Vegas (supported by COMDEX), the only Apache event to be fully supported by the ASF. http://www.apachecon.com _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by: See the NEW Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user