Title: JAXP via reflection????
I am using latest xerces.jars (version 2.0.2) and jaxp.jar (java_xml_pack-summer-02, version 1.2) files and same are included in classpath.
 
 
-----Original Message-----
From: James Strachan [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 30, 2002 3:49 AM
To: Rathore, Ritesh (GEA, TEMP, 096462); [EMAIL PROTECTED]
Subject: Re: [dom4j-dev] JAXP via reflection????

The warning usually means that some classloading issues occurred. This can happen if you have an old 1.0.x version of JAXP, or if the JAXP classes were found on the classpath but that no JAXP compliant parser was found.
 
So if you get a recent distribution (1.1 or later) of JAXP and a JAXP compliant parser, everything should just work. e.g. jaxp.jar and crimson.jar on your classpath, or a recent Xerces distro with xmlParserAPIs.jar and xercesImpl.jar.
 
My guess is that you either have an old JAXP jar thats not 1.1 or later, or that you don't have a matching JAXP implementaiton jar (xerces or crimson)

James
----- Original Message -----
Sent: Thursday, June 27, 2002 9:15 PM
Subject: [dom4j-dev] JAXP via reflection????

In the documentation of org.dom4j.io.SAXReader class, following is written:

" If the org.xml.sax.driver system property is not defined then JAXP is used via reflection (so that DOM4J is not explicitly dependent on the JAXP classes) to load the JAXP configured SAXParser. "

I haven't understood the meaning of above sentence.

When I run the following code, I get the warning "Warning: Error occurred using JAXP to load a SAXParser. Will use Aelfred instead."

public static void main(String argv[]) {
        try {

            URL fileURL = new File("anyfile.xml").toURL();

            SAXReader reader = new SAXReader();
            Document doc = reader.read(fileURL);

            System.out.print(doc.asXML()) ;

        } catch (Exception e) {
           e.printStackTrace(System.err);
          }
}

Can anyone tell me how to avoid Aelfred and load JAXP onfigured SAXParser instead?

Please note that I  don't get any warning or error if I use org.xml.sax.driver system property as in following code:

public static void main(String argv[]) {
        try {

            URL fileURL = new File("report.xml").toURL();

           System.setProperty("org.xml.sax.driver","org.apache.xerces.parsers.SAXParser");
          
           XMLReader xr = XMLReaderFactory.createXMLReader() ;

           SAXReader reader = new SAXReader(xr);

           Document doc = reader.read(fileURL);

           System.out.print(doc.asXML()) ;

        } catch (Exception e) {
            e.printStackTrace(System.err);
            }
}

Reply via email to