Hello Angus, Your setup appears to be correct. I noticed you're using the new 2003 namespace [1] in your instance document. We missed making that change in Xerces 2.6.0 so in order to work with the current version of the parser you need to use the 2001 namespace [2]. The source has been updated in CVS to accomodate the change made in the new Working Draft. If you don't want to change your instance documents you can pickup a recent nightly build [3].
Hope that helps. [1] http://www.w3.org/TR/2003/WD-xinclude-20031110/#syntax [2] http://www.w3.org/TR/2002/CR-xinclude-20020917/#syntax [3] http://gump.covalent.net/jars/latest/xml-xerces2/ On Thu, 18 Dec 2003, Angus Stewart wrote: > Cannot get XInclude to work. Searched archives for XInclude, and while > there are quite a few entries, and even some claim of success, none > provide the steps required to get there. > > I would appreciate it if anyone can help me out with this, and/or > provide samples. > > Following is the test I setup: > > Configuration: > Windows XP > Cygwin > JDK1.4.2-b28 > Xerces 2.6.0 > > Xerces jar files in: > $JAVA_HOME/lib/endorsed > $JAVA_HOME/jre/lib/endorsed > (was not sure where to put them so put them in both). > > > Compile and Run commands: > XD=org.apache.xerces.xni.parser.XMLParserConfiguration > XI=org.apache.xerces.parsers.XIncludeParserConfiguration > > javac -classpath . Test.java > java -classpath . -D"$XD=$XI" Test > > > ----- Test Class ---------------- > import org.apache.xerces.parsers.DOMParser; > import org.apache.xml.serialize.XMLSerializer; > import org.apache.xml.serialize.OutputFormat; > import org.w3c.dom.Document; > import java.io.StringWriter; > > public class Test { > public static void main (String [] args) { > try { > DOMParser p = new DOMParser(); > p.parse("contact.xml"); > > Document d = p.getDocument(); > > StringWriter out = new StringWriter(); > (new XMLSerializer(out, new OutputFormat())).serialize(d); > > System.err.println(out.toString()); > } > catch (Exception e) { > e.printStackTrace(); > } > } > } > > ----- contact.xml ----- > <?xml version="1.0" encoding="UTF-8"?> > <contact xmlns:xi="http://www.w3.org/2003/XInclude"> > <xi:include href="name.xml"/> > <!-- <xi:include href="file:name.xml"/> --> > <!-- <xi:include href="file:/name.xml"/> --> > <!-- <xi:include href="file:///name.xml"/> --> > <!-- <xi:include href="file:///home/angus/.../name.xml"/> --> > <!-- <xi:include href="file:///C:/.../name.xml"/> --> > </contact> > > ----- name.xml ----- > <?xml version="1.0" encoding="UTF-8"?> > <name> > <first/> > <last/> > <initial/> > <title/> > </name> > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------- Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
