Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#11 XInclude support

open
nobody
None
5
2002-12-04
2002-12-04
No

Request for enhancement
-----------------------
This is a suggestion to enhance PSGML to provide
XInclude support (that is, support for editing "split
documents" that are split using XInclude instances).

Basically, XInclude support would mean that prior to
performing any interactive validation checking for a
certain (parent) document instance, PSGML would include
a (child) document instance "foo.xml" in the parent
document if an XInclude instance such as the following
occurs in the parent document.

<xi:include href="foo.xml/>

PSGML wouldn't need to physically copy the contents
from the included document (that is, not do the
equivalent of an sgml-expand-entity-reference).
Instead, it'd basically just what it does now with
external entity references such as the following:

<?xml version="1.0"?>
<!DOCTYPE book SYSTEM "book.dtd" [
<!ENTITY foo SYSTEM "foo.xml">
]>
<book>
<title>bar</title>
&foo;
</book>

That is, it would include the contents of the child
document in the in-memory parse tree it builds for the
parent document.

But one significant difference is that unlike the
foo.xml file included via the entity-reference
mechanism, the foo.xml file included using the XInclude
instance may contain its own:

* XML declaration (e.g., <?xml version="1.0"?>)

* document type (DTD) declaration -- optionally
including an internal DTD subset

PSGML should basically just ignore the XML and DTD
declarations when including the child document (they're
not part of the parse tree) -- except for one important
difference: PSGML needs to resolve any external entity
references in the internal DTD subset of the child
document before including it in the parent document.

Background
----------
XInclude is an XML evolution of (or alternative to) the
SGML/XML mechanism of using external entity references
to include one document within another (parent) doc.

Here's a (better) short definition:

XInclude is an emerging W3C specification for
building large XML documents out of multiple
well-formed XML documents, independently of
validation. Each piece can be a complete XML
document, a fragmentary XML document, or a non-XML
text document like a Java program or an e-mail
message.[1]

A variety of software already exists that supports
processing of XIncludes, including Libxml2/Libxslt/
xsltproc, Apache Cocoon, 4Suite (Python library), and
GNU JAXP.

Here's an example (from the XInclude spec) of XInclude
processing with a simple doc instance [2].

The following XML document contains an xi:include
element which points to an external document. Assume
the base URI of this document is
http://www.example.org/document.xml.

<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
<p>120 Mz is adequate for an average home user.</p>
<xi:include href="disclaimer.xml"/>
</document>

disclaimer.xml contains:

<?xml version='1.0'?>
<disclaimer>
<p>The opinions represented herein represent
those of the individual
and should not be interpreted as official policy
endorsed by this
organization.</p>
</disclaimer>

The infoset resulting from resolving inclusions on
this document is the same as that of the following
document:

<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
<p>120 Mz is adequate for an average home user.</p>
<disclaimer
xml:base="http://www.example.org/disclaimer.xml">
<p>The opinions represented herein represent
those of the individual
and should not be interpreted as official policy
endorsed by this
organization.</p>
</disclaimer>
</document>

[1] http://www.xml.com/lpt/a/2002/07/31/xinclude.html
[2] http://www.w3.org/TR/xinclude/#examples

Discussion