| Questions |
| Usage xml:base attributes and XML Schema validation XML Base Support Document Fragments Content Negotiation The Namespace: 'http://www.w3.org/2001/XInclude'
| Answers |
| How do I enable XInclude processing? |
| The simplest way to enable XInclude processing is to use a `org.apache.xerces.parsers.XIncludeParserConfiguration` as your parser configuration. This configuration includes a DTD validator, a namespace binder, and a Schema validator, in addition to a handler for XInclude. See this FAQ for instructions about how to change your parser configuration. If `XIncludeParserConfiguration` doesn't meet your needs, then you'll have to write your own parser configuration. Make sure that this configuration includes a `org.apache.xerces.xinclude.XIncludeHandler`, and that the property "http://apache.org/xml/properties/internal/namespace-context" is an instance of `org.apache.xerces.xinclude.XIncludeNamespaceSupport`. It is strongly recommended that the `XIncludeHandler` be placed in the pipeline before the Schema validator, if there is one. PSVI information cannot be guaranteed to be valid after XInclude processing.
| 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. The 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. If this solution is really unappealing to you, voice your concerns on the xerces-j-user mailing list.
| 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 2.6.0.
| Why doesn't including document fragments work? |
| Currently, our implementation of XInclude is not fully complete, and we do not support XPointer references. We hope that in the future we will have a fully compliant XInclude processor that can handle this feature.
| Are the values of the content negotiation attributes used in an HTTP request? |
| Currently, the values of the `accept`, `accept-charset` and `accept-language` attributes from an include element are only included in an HTTP request for included items when parse="text". We hope that in the future we will be able to support content negotiation for included items when parse="xml".
| Will the XInclude processor process include elements from the 'http://www.w3.org/2001/XInclude' namespace? |
| No. The namespace for XInclude was changed during development to `http://www.w3.org/2003/XInclude`. The specification recommends that XInclude processors provide a diagnostic for include elements in the old namespace. Xerces' XInclude processor will report a warning.