Stanimir Stamenkov <[EMAIL PROTECTED]> wrote on 11/04/2005 09:46:22 AM:
> /Nigel Kibble/: > > > My question is, when I implement the code (shown below) with > > XercesImpl.Jar in my classpath, am I using the Xerces SAXParser (from > > the .jar) or am I using SAXParser supplied in the JDK? > > Note you need both "xml-apis.jar" and "xercesImpl.jar" in your > classpath. Read the 'SAXParserFactory.newInstance()' documentation: > > http://java.sun.com/j2se/1.4. > 2/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance() > > to find how the JAXP implementation plugging facility works. The > "xercesImpl.jar" has > "META-INF/services/javax.xml.parsers.SAXParserFactory" included > which directs the SAXParserFactory instance to be created of type > 'org.apache.xerces.jaxp.SAXParserFactoryImpl' which then creates > Xerces implemented parsers - there's no need to use the "endorsed" > directory to override system classes, just put the two Xerces JARs > on the classpath. > > On the other hand if you want to use the DOM Level 3 interfaces > provided by Xerces you'll need to put at least the "xml-apis.jar" in > the "endorsed" libraries, at least for compilation - I'm not sure if > one would need it run-time. You should always use the endorsed standards mechanism for the JAXP 1.3 APIs when running on J2SE 1.4. JAXP 1.3 and DOM Level 3 added methods to existing classes and interfaces, all of which are present when the parser is compiled. If you simply put xml-apis.jar on the classpath you risk running your application with a mix of classes from JAXP 1.1 and 1.3 which may lead to a NoSuchMethodError being thrown at some point during processing becuase of the mismatch. > -- > Stanimir > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
