A few more notes that may help:

* The DOM and SAX parsers decide which parser configuration to use in
* the following order:
*
* First, the org.apache.xerces.xni.parser.XMLParserConfiguration system
* property is queried for the class name of the parser configuration.
*
* Next, if a file called xerces.properties exists in the lib
* subdirectory of the JRE installation and the
* org.apache.xerces.xni.parser.XMLParserConfiguration property is
* defined it, then its value will be read from the file.
*
* Next, the org.apache.xerces.xni.parser.XMLParserConfiguration file is
* requested from the META-INF/services/ directory. This file contains
* the class name of the parser configuration.
*
* Finally, the org.apache.xerces.parsers.XML11Configuration is used as
* the default parser configuration.

1. I am setting the parser at the command line.
2. There is no file called xerces.properties anywhere on my system.
3. I do not have a META-INF/services directory.

If I run the test with the verbose switch, I can see the XML11Configuration is loaded. The xinclude is not.

Angus Stewart wrote:

Thanks,

Changed the namespace:
 >><contact xmlns:xi="http://www.w3.org/2003/XInclude";>
<contact xmlns:xi="http://www.w3.org/2001/XInclude";>

Still not getting the desired results.

Output shows the xi:include elements. There seems to be no attempt to resolve the external documents.

Michael Glavassevich wrote:

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]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to