<div dir="ltr">Hello all,<br> I'm using Jdom 2.0.5 and opening a document one.xml which includes another file two.xml through xinclude. I'm calling the builder as follows:<br><br> SAXBuilder builder = new SAXBuilder();<br>
builder.setJDOMFactory(new LocatedJDOMFactory());<br> builder.setFeature("<a href="http://apache.org/xml/features/xinclude">http://apache.org/xml/features/xinclude</a>", true);<br> Document doc = builder.build(new File("c:\\temp\\one.xml"));<br>
XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());<br> System.out.println("salida es "+out.outputString(doc));<br><br>the file one.xml is as follows:<br><br> <?xml version="1.0" encoding="UTF-8" ?><br>
<eco xmlns:xi="<a href="http://www.w3.org/2001/XInclude">http://www.w3.org/2001/XInclude</a>"><br> <tmp-path>/opt/eco/ecoprd/tmp</tmp-path><br> <!--<br> <xi:include href="two.xml" parse="xml"/><br>
--><br> <xi:include href="two.xml" parse="xml" xpointer="web-servers"/><br> </eco><br><br>and two.xml is as follows:<br><br> <?xml version="1.0" encoding="UTF-8" ?><br>
<eco><br> <web-servers xml:id="web-servers"><br> <valuations><br> <url-base><a href="http://naboo:8080">http://naboo:8080</a></url-base><br> <context>/Statements</context><br>
<path>/services/ValuationsXMLGenerator</path><br> </valuations><br> </web-servers><br> </eco><br><br>the inclusion of the file without the xpointer works fine. But if I use xpointer, I get an error as follows:<br>
<br> org.jdom2.input.JDOMParseException: Error on line 7 of document file:/c:/temp/one.xml: An 'include' failed, and no 'fallback' element was found.<br> at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:228)<br>
at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:277)<br> at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:264)<br> at org.jdom2.input.SAXBuilder.build(SAXBuilder.java:1116)<br>
at test.XMLTest.main(XMLTest.java:17)<br> Caused by: org.xml.sax.SAXParseException; systemId: file:/c:/temp/one.xml; lineNumber: 7; columnNumber: 65; An 'include' failed, and no 'fallback' element was found.<br>
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)<br> at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)<br> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)<br>
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)<br> at org.apache.xerces.xinclude.XIncludeHandler.reportError(Unknown Source)<br> at org.apache.xerces.xinclude.XIncludeHandler.reportFatalError(Unknown Source)<br>
at org.apache.xerces.xinclude.XIncludeHandler.reportFatalError(Unknown Source)<br> at org.apache.xerces.xinclude.XIncludeHandler.reportFatalError(Unknown Source)<br> at org.apache.xerces.xinclude.XIncludeHandler.emptyElement(Unknown Source)<br>
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)<br> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)<br> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)<br>
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)<br> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)<br> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)<br>
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)<br> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)<br> at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:217)<br>
... 4 more<br><br>What I'm missing? supposedly the xpointer="web-servers" should get the element web-serves with xml:id="web-servers", but it is not. Any suggestions?<br><br></div>