Release Info


API JavaDoc


XNI Manual
XML Schema

Source Repository
User Mail Archive
Dev Mail Archive


How do I enable XInclude processing?

Applications using JAXP 1.3 (and above) can enable XInclude processing by setting XInclude awareness on the parser factory. The following demonstrates how to accomplish this with SAX:

import javax.xml.parsers.SAXParserFactory;
SAXParserFactory spf = SAXParserFactory.newInstance();

You can also enable XInclude processing by turning on the XInclude feature.

How do the validation features interact with XInclude processing?

If the validation feature is turned on then DTD validation will be performed on each source document (to the XInclude processor) against their respective DTDs.

If both the validation feature and the schema validation feature are turned on then schema validation will be performed on the result infoset generated by the XInclude processor. DTD validation will be performed on each source document which contains a DTD. No DTD validation errors will be reported for source documents which have no DTD.

Why are xml:base attributes added, which make Schema validation fail?

According to the specification for XInclude, processors must add an xml:base attribute to elements included from locations with a different base URI. Without these attributes, the resulting infoset information would be incorrect. Unfortunately, these attributes make XInclude processing not transparent to Schema validation.

One solution to this is to modify your schema to allow xml:base attributes to appear on elements that might be included from different base URIs. There is a similar problem with xml:lang attributes that are added as a result of language fixup. If the addition of xml:base and/or xml:lang is undesired by your application, you can disable base URI fixup and language fixup so that these attributes will not be added.

Does the XInclude processor recognize xml:base attributes?

Yes. The XInclude specification requires processors to use the base URI (as specified in the XML Base recommendation) to resolve relative IRIs to compute the include location. Support for XML Base was added to the XInclude implementation in Xerces-J 2.6.0.

Does the XInclude processor perform language fixup?

Yes. The XInclude processor will preserve language information on a top-level included element by adding an xml:lang attribute if its include parent has a different [language] property. Support for language fixup was added to the XInclude implementation in Xerces-J 2.7.0.

Does the XInclude processor perform references property fixup?

Section 4.5.3 of the XInclude 1.0 W3C Recommendation describes fixup of the [references] property of an attribute information item. For IDREF/IDREFS the property contains an ordered list of element information items. Xerces provides no mechanism for accessing this property nor does it keep an internal representation. It should be noted that neither the SAX or DOM APIs have native support for the [references] property. For Xerces, references property fixup is a no-op.

Does the XInclude processor support XPointer?

Yes. The XInclude processor supports the XPointer Framework and the XPointer element() Scheme. The XPointer xpointer() Scheme is currently not supported.

What types of IDs are currently supported for XPointers?

For shorthand pointers and element() XPointers, currently only DTD-determined IDs are supported. schema-determined IDs may be supported in a future release.

Are the values of the content negotiation attributes used in an HTTP request?

Yes, the values of the accept and accept-language attributes from an include element are included as request properties in an HTTP request. Support for content negotiation when parse="xml" was added to the XInclude implementation in Xerces-J 2.7.0.

Will the XInclude processor process include elements from the '' namespace?

No. The namespace for XInclude was changed back to in the Candidate Recommendation (April 2004). The namespace is no longer recognized.

Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.