Hi all,

Attached is the preliminary implementation of XInclude that I've developed.
It supports most normal functions: regular includes, text includes,
fallbacks, namespace fix-up, etc, and it should be okay for regular use.

Functionality that is currently missing:
- XPointer support. Currently, only whole files can be included in a
document.  This will require XPath support in Xerces.  Also, there are
problems using XPointers with a streaming API.

- Fix-up of unparsed entities and notations.  If an included document has
attributes which reference unparsed entities or notations which are not in
the root document, they will not be resolved properly.  This is pending
resolution of some issues regarding whether unparsedEntityDecl() and
notationDecl() events can be sent after endDTD() is sent.

- Default pipeline.  XInclude works by creating a new partial pipeline when
a new document is included.  At the moment, this pipeline is always an
XIncludeParserConfiguration.  I plan to add a property, or some other
fuctionality, to allow this to be user specified.  However, an
XIncludeParserConfiguration should be fine for most users.

- Copy features from parent pipeline to child pipeline.  Currently, the
child pipelines only use the default set of features.  I will add
functionality to copy the features of the original pipeline to the created
pipelines.

- Placement of XIncludeHandler in the pipeline.  Currently, the
XIncludeHandler has only been tested if it goes before schema validation in
the pipeline.

- Encoding of included documents when parse="text".  I'm not 100% certain
if text include detects encodings according to the XInclude spec.  See
"advanced testing" below :)

- Advanced testing.  I've tested this on the available online test suite
for XInclude, and it passes all of the tests except those dealing with the
above issues.  However, that is not a complete test suite, and I haven't
done advanced tested other that suite.

- Performance tweaking.  I haven't done any performance testing, but I
suspect XInclude doesn't speed things up at all :)

To use XInclude, specify your ParserConfiguration as an
org.apache.xerces.parsers.XIncludeParserConfiguration.  This will add an
org.apache.xerces.xinclude.XIncludeHandler to the pipeline, which will look
for <include> and <fallback> tags and (presumeably) do The Right Thing when
it finds one.

At the moment, the include process is almost transparent to schema
validation.  However, xml:base attributes are added to included documents
which do not have the same base URI as their parent.  So if you use schema
validation, and your included documents aren't in the same directory as the
including document, make sure your schema allows xml:base attributes on top
level included items.  It's possible that this may change in the future,
but at the moment, don't count on it.

Please let me know if you have any comments, suggestions etc.

Peter McCracken/Toronto/IBM

(See attached file: xinclude.jar)

Attachment: xinclude.jar
Description: Binary data

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

Reply via email to