I have a variety of remarks with respect to using modular documents in
XXE that refer to absolute global contexts.

First of all, I have a user-interface question.  It appears to me (from
the Tutorial on creating a modular document and from experience) that
the only way to create modular documents is to use the "Copy as
Reference" functionality.  However, this does not allow a user to
manually create a reference.  In particular, there is no way to create a
reference to a global URI.  For example, there would be no way to
specify the target of the xi:include statement in the following example:

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd";>
  <article>
    <title>This document includes another global document</title>

    <section>
      <title>A section only from the including document</title>

      <para>Random content</para>
    </section>

    <xi:include href="http://www.example.org/include_from_me.xml";
                xmlns:xi="http://www.w3.org/2001/XInclude"; xpointer="test" />
  </article>

However, XXE will open the document.  The global reference does not
resolve, but with an XML Catalog visible to XXE such as:

  <?xml version="1.0"?>
  <!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog 
V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";>
  <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
    <uri name="http://www.example.org/include_from_me.xml"; 
uri="file:///home/john/include_from_me.xml"/>
  </catalog>

Where the file file:///home/john/include_from_me.xml is as follows:

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd";>
  <article>
    <title>Test</title>

    <section id="test">
      <title>This is only a test</title>

      <para>This section has an <markup>id</markup> of "test".</para>
    </section>
  </article>

XXE correctly opens the original document, resolves the global
reference, and processes the xi:include.

The next concern is that attempting to use "Edit Referenced Document" on
the included section gives the following error:

  Cannot open file "http://www.example.org/include_from_me.xml":
  http://www.example.org/include_from_me.xml

I would think that this URI should be resolved for both editing and
inclusion consistently (and hopefully using the XML Catalog entry in
both cases).

Next up, the same inclusion scenario with a slightly different
construction - using xml:base - does *not* work.  Here's the test case:

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd";>
  <article xml:base="http://www.example.org/";>
    <title>This document includes another global document</title>

    <section>
      <title>A section only from the including document</title>

      <para>Random content</para>
    </section>

    <xi:include href="include_from_me.xml"
                xmlns:xi="http://www.w3.org/2001/XInclude"; xpointer="test" />
  </article>

When opening this file (note the upgrade in the DocBook version being
used to accomodate xml:base), a warning is generated:

  Document has 1 errors [sic] related to XInclude:
  /article/xi:include:
  cannot load file "http://www.example.org/include_from_me.xml":
  http://www.example.org/include_from_me.xml

Although it seemed previously to handle the reference correctly.

I think that covers it with respect to the issues I ran into playing
with XIncludes.  As always, thanks for your time.

Take care,

    John L. Clark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20041025/fff67bcc/attachment.sig
 

Reply via email to