[jdom-interest] Validate XML with XSD Schema with DOMBuilder

kerod at hotmail.fr kerod at hotmail.fr
Mon May 28 07:37:07 PDT 2007


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20070528/3a3b69d5/attachment.htm


More information about the jdom-interest mailing list