Validate XML with XSD Schema with DOMBuilder
| Newsgroups | gmane.comp.java.jdom.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have a big problem with DOMBuilder. I want to parse an XML document and validate it with a XML Schema but with DOMBuilder it can't do it. Why ?
Here my code :
public int validXMLWithDOM(File xmlFile)
{
try
{
DOMParser dom = new DOMParser(); //Instanciation d'un élément DOM
DOMBuilder jdomParser = new DOMBuilder("org.apache.xerces.parsers.DOMParser"); //Instanciation d'un élément JDOM
//Parse le document afin de récupérer un arbre DOM
dom.setFeature("http://xml.org/sax/features/validation", true);
dom.parse("Durand.xml");
org.w3c.dom.Document docDom = dom.getDocument();
//Récupération de notre arbre JDOM
org.jdom.Element jdomDoc = jdomParser.build(docDom.getDocumentElement());
}
catch(DOMParseException e)
{
e.printStackTrace();
}
catch(Exception e)
{
e.printStackTrace();
}
return 0;
}
Where is the problem ? How Can I get the error with DOMParseException ?
Thanks
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]