I have been using Xerces-J for close to 3 months and am confused on how to use JAXP with it without running into CLASSPATH problems. Can someone provide a definitive overview on what parsers support JAXP, the correct versions 1.0 vs 1.1 and the exact configuration for the environ to work? I intend to port all my xml & xslt processing code to JAXP. Thanks Pho
Hi Pho, I don't have time right now to code an example for you but JAXP is very simple and already integrated into Xerces so I don't think you will have any problem converting your code to use JAXP. JAXP is simply a pluggability API that allows you to use the SAX or DOM parser of your choice that have implemented subclasses of javax.xml.parsers.DocumentBuilderFactory and javax.xml.parsers.SaxParserFactory. Which parser is actually used depends on the value of the Java System properties: javax.xml.parsers.DocumentBuilderFactory and javax.xml.parsers.SAXParserFactory. The value of these properties need to be a subclass to instantiate. For example, Xerces reimplemented the abstract classes in javax.xml.parsers (and includes them in their distribution, so if you have the xerces jar in your classpath you are set). Here is what Xerces sets the value of the Document Builder Factory to: private static String factory= "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"; You can set these properties in one of two ways: System.setProperty(key, value); // check out the docs or the -D option when invoking java Hope this helps, - Mike
Michael Daconta<BR>firstname.lastname@example.org<BR>Author of <A HREF="http://www.amazon.com/exec/obidos/ASIN/0672316536/ref=ase_electricporkchop/107-2476442-4883722" TARGET=_blank rel="nofollow">XML Development with Java 2</A>.
I've seen a lot of software packaged with these files: - jaxp.jar - parser.jar Is there a way to probe the jars to find out the exact versions of JAXP that's supported here other than listing the contents of the jars ? Cheers Pho