I have some files that contain such structures: --- before.xml --- | ... | <xlink:locator xlink:href="foobar.xml" xlink:type="locator" xlink:label="foobar"/> | ... --- end of before.xml ---
I wish I could XInclude the foobar.xml at that precise location. So I use a sed script that search/replace each xlink and replace it with its xinclude counterpart. Here is the kind of result: --- after.xml --- | ... | <xinclude:include href="foobar.xml"/> | ... --- end of after.xml --- And then, I use such a code to magically manages the XInclude of files: --- myCode.java --- | SAXParserFactory factory = (SAXParserFactory) | SAXParserFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl", this.getClass().getClassLoader()); | factory.setXIncludeAware(true); | factory.setNamespaceAware(true); | SAXParser parser = factory.newSAXParser(); | XMLReader xmlReader = parser.getXMLReader(); | sr = new org.dom4j.io.SAXReader(xmlReader); | ... --- end of myCode.java --- It works perfectly fine. But now I want to get rid of the sed script, and add some kind of magic to manage the Xlink->XInclude in Java. Obviously, this preprocessing must occur before the XInclude processing of Xerces. So I cannot use the usual XMLFilter technique (as I understand it, any XMLFilter would occur *after* the XInclude resolving). What is the most elegant manner to achieve my preprocessing and then benefit from the built-in XInclude engine? My idea was a kind of SAX pipelining, but I cannot see how to do that. Any help is welcome. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]