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);
}
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);
}