Using JAXP 1.3 with J2EE 1.3.1

H

Hugh McBride

I am trying to use the new XInclude feature of JAXP 1.3 (unbundled)
but
I am restricted to J2EE 1.3.1 . I have already placed the dom.jar,
sax.jar
xalan.jar and xercesImple.jar in the <java_home>jre/lib/ext/ directory
(using the endorsed directory is for JDK 1.4 . But the sample
XInlcude demo
included will not compile. What info I could find said not to add the
jaxp-api.jar (Have tried it with and with out still doesnt work

The main method of the of the class is below with
the line causing the problem marked

Any help/pointer would be greatly appreciated .
Am using eclipse 3.0 as an editor and am sure there is no
problem there

public static void main(String argv[])
{

if (argv.length < 2)
{
printUsage();
System.exit(1);
}
try
{

--> DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
// make parser xinclude aware by setting the XIncludeAware
to true.
dbf.setXIncludeAware(true);
dbf.setNamespaceAware(true);
// parse the xml file.
DocumentBuilder parser = dbf.newDocumentBuilder();
parser.setErrorHandler(new ErrorHandlerImpl());
Document doc = parser.parse(argv[0]);
// write the output to specified file.
DOMImplementation impl = doc.getImplementation();
DOMImplementationLS implLS = (DOMImplementationLS)
impl.getFeature("LS", "3.0");
DOMErrorHandlerImpl eh = new DOMErrorHandlerImpl();
Output out = new Output();

LSSerializer writer = implLS.createLSSerializer();
writer.getDomConfig().setParameter("error-handler", new
DOMErrorHandlerImpl());
out.setSystemId(argv[1]);
writer.write(doc, out);
System.out.println("//////// finished /////////");

}
catch (Exception ex)
{
System.out.println("Error occurred" + ex);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top