- From: <agil.bull@laposte.net>
- Date: Tue, 10 Sep 2002 08:54:24 -0400 (EDT)
- To: "xmlschema-dev" <xmlschema-dev@w3.org>
Hi, I am working on a Servlet which use a org.w3c.dom.Document. I do several action on this Document. Juste before saving the modifications, I have to validate this Document with an XSD file. Here is my code : ********************** public void validerModifications(EntiteModifiable entitemodifiable, Document document) { String strXSDFile = PropertiesManager.getProp("XML_DIR") + "NORME.xsd"; try { DOMParser parser = new DOMParser(); parser.setFeature("http://xml.org/sax/features/validation", true); parser.setFeature ("http://apache.org/xml/features/validation/schema", true); parser.setProperty ("http://apache.org/xml/properties/schema/external- noNamespaceSchemaLocation", strXSDFile); RialtoErrorChecker errors = new RialtoErrorChecker(); parser.setErrorHandler(errors); InputSource is = new InputSource(new StringReader (Noeud.documentToStream(document).toString())); parser.parse(is); } catch (Exception e) { System.out.print("Problem parsing the file."); } } ********************** As you can see, I have to transform my Document to an InputSource. The static method Noeud.documentToStream transform a Document to an OutputStream. Then I have to parse this InputSource to know if my Document is valid. I just wan't to know if my Document is valid without parse it or at least, without transform the Document in InputSource before. Thanks Cédric Accédez au courrier électronique de La Poste : www.laposte.net ; 3615 LAPOSTENET (0,13 €/mn) ; tél : 08 92 68 13 50 (0,34€/mn)"
Received on Tuesday, 10 September 2002 17:21:59 UTC