APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.org.apache.xerces.internal.xinclude

public Class XIncludeHandler

extends Object
implements XMLComponent, XMLDocumentFilter, XMLDTDFilter
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.xerces.internal.xni.parser.XMLDTDFilter, com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource, com.sun.org.apache.xerces.internal.xni.XMLDTDHandler, com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentFilter, com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource, com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler, com.sun.org.apache.xerces.internal.xni.parser.XMLComponent
Known Direct Subclasses
com.sun.org.apache.xerces.internal.xpointer.XPointerHandler
Imports
com.sun.org.apache.xerces.internal.impl.Constants, .XMLEntityManager, .XMLErrorReporter, com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException, com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter, com.sun.org.apache.xerces.internal.parsers.XIncludeParserConfiguration, .XPointerParserConfiguration, com.sun.org.apache.xerces.internal.util.AugmentationsImpl, .HTTPInputSource, .IntStack, .ParserConfigurationSettings, .SymbolTable, .URI.MalformedURIException, .URI, .XMLAttributesImpl, .XMLChar, .XMLLocatorWrapper, .XMLResourceIdentifierImpl, .XMLSymbols, com.sun.org.apache.xerces.internal.xni.Augmentations, .NamespaceContext, .QName, .XMLAttributes, .XMLDTDHandler, .XMLDocumentHandler, .XMLLocator, .XMLResourceIdentifier, .XMLString, .XNIException, com.sun.org.apache.xerces.internal.xni.parser.XMLComponent, .XMLComponentManager, .XMLConfigurationException, .XMLDTDFilter, .XMLDTDSource, .XMLDocumentFilter, .XMLDocumentSource, .XMLEntityResolver, .XMLInputSource, .XMLParserConfiguration, com.sun.org.apache.xerces.internal.xpointer.XPointerHandler, .XPointerProcessor, java.io.CharConversionException, .IOException, java.util.ArrayList, .Enumeration, .List, .Locale, .Objects, .Stack, .StringTokenizer, javax.xml.XMLConstants, javax.xml.catalog.CatalogException, .CatalogFeatures, .CatalogManager, .CatalogResolver, javax.xml.transform.Source, jdk.xml.internal.JdkConstants, .JdkXmlUtils, .XMLSecurityManager, .XMLSecurityPropertyManager, org.xml.sax.InputSource

This is a pipeline component which performs XInclude handling, according to the W3C specification for XML Inclusions.

This component analyzes each event in the pipeline, looking for <include> elements. An <include> element is one which has a namespace of http://www.w3.org/2001/XInclude and a localname of include. When it finds an <include> element, it attempts to include the file specified in the href attribute of the element. If inclusion succeeds, all children of the <include> element are ignored (with the exception of checking for invalid children as outlined in the specification). If the inclusion fails, the <fallback> child of the <include> element is processed.

See the XInclude specification for more information on how XInclude is to be used.

This component requires the following features and properties from the component manager that uses it:

Optional property: Furthermore, the NamespaceContext used in the pipeline is required to be an instance of XIncludeNamespaceSupport.

Currently, this implementation has only partial support for the XInclude specification. Specifically, it is missing support for XPointer document fragments. Thus, only whole documents can be included using this component in the pipeline.

Authors
Peter McCracken, IBM, Michael Glavassevich, IBM
See Also
XIncludeNamespaceSupport

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
protected static class

Field Summary

Modifier and TypeField and Description
protected static final String
ALLOW_UE_AND_NOTATION_EVENTS

Feature identifier: allow notation and unparsed entity events to be sent out of order.

protected static final String
BUFFER_SIZE

property identifier: buffer size.

public static final String
CURRENT_BASE_URI

The identifier for the Augmentation that contains the current base URI

protected static final String
DYNAMIC_VALIDATION

Feature identifier: dynamic validation.

protected static final String
ENTITY_RESOLVER

Property identifier: entity resolver.

protected static final String
ERROR_REPORTER

Property identifier: error reporter.

protected final Stack<String>
protected final IntStack
protected int
pack-priv CatalogFeatures
private String
pack-priv CatalogResolver
protected XMLParserConfiguration
protected final XMLResourceIdentifier
protected String
private String
private int
protected XMLLocator
protected XMLDocumentHandler
protected XMLDocumentSource
protected XMLDTDHandler
protected XMLDTDSource
private static final Boolean[]
FEATURE_DEFAULTS

Feature defaults.

protected XMLEntityResolver
protected XMLErrorReporter
protected final Stack<String>
private boolean
private boolean
pack-priv boolean
protected String
private boolean
private boolean
protected final IntStack
protected final Stack<String>
protected final Stack<String>
protected XIncludeNamespaceSupport
private boolean
private final List<XIncludeHandler.Notation>
protected String
protected XIncludeHandler
private String
private String
private int
private boolean[]
private boolean[]
protected XMLSecurityManager
protected XMLSecurityPropertyManager
private boolean
private boolean
protected ParserConfigurationSettings
private int[]
protected SymbolTable
private final List<XIncludeHandler.UnparsedEntity>
private boolean
fUseCatalog

indicate whether Catalog should be used for resolving external resources

protected XIncludeTextReader
protected XIncludeTextReader
protected XMLParserConfiguration
protected XMLLocatorWrapper
protected XIncludeMessageFormatter
protected XMLParserConfiguration
protected XPointerProcessor
private static final char[]
private static final char[]
private static final char[]
private static final boolean[]
public static final String
public static final String
private static final int
protected static final String
JAXP_SCHEMA_LANGUAGE

Property identifier: JAXP schema language.

private static final QName
protected static final String
private static final Object[]
PROPERTY_DEFAULTS

Property defaults.

private static final String[]
RECOGNIZED_FEATURES

Recognized features.

private static final String[]
RECOGNIZED_PROPERTIES

Recognized properties.

protected static final String
SCHEMA_VALIDATION

Feature identifier: schema validation.

protected static final String
SECURITY_MANAGER

property identifier: security manager.

private static final int
private static final int
private static final int
protected static final String
SYMBOL_TABLE

Property identifier: symbol table.

protected static final String
VALIDATION

Feature identifier: validation.

public static final String
public static final String
public static final String
public static final String
public static final String
private static final String
public static final String
protected static final String
XINCLUDE_FIXUP_BASE_URIS

Feature identifier: fixup base URIs.

protected static final String
XINCLUDE_FIXUP_LANGUAGE

Feature identifier: fixup language.

public static final String
public static final String
private static final String
public static final String
public static final String
public static final String
private static final QName
private static final QName
protected static final String
XML_SECURITY_PROPERTY_MANAGER

property identifier: XML security property manager.

public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
addNotation(String
the name of the notation
name
,
XMLResourceIdentifier
the location of the notation
identifier
,
Augmentations
any Augmentations that were on the original notation declaration
augmentations
)

Caches a notation.

protected void
addUnparsedEntity(String
the name of the unparsed entity
name
,
XMLResourceIdentifier
the location of the unparsed entity
identifier
,
String notation, Augmentations
any Augmentations that were on the original unparsed entity declaration
augmentations
)

Caches an unparsed entity.

public void
attributeDecl(String elementName, String attributeName, String type, String[] enumeration, String defaultType, XMLString defaultValue, XMLString nonNormalizedDefaultValue, Augmentations augmentations)

Implements com.sun.org.apache.xerces.internal.xni.XMLDTDHandler.attributeDecl.

An attribute declaration.

public void
protected void
checkAndSendNotation(XIncludeHandler.Notation
the Notation to check for conflicts
not
)

The purpose of this method is to check if a Notation conflicts with a previously declared notation in the current pipeline stack.

protected void
checkAndSendUnparsedEntity(XIncludeHandler.UnparsedEntity
the UnparsedEntity to check for conflicts
ent
)

The purpose of this method is to check if an UnparsedEntity conflicts with a previously declared entity in the current pipeline stack.

private void
checkMultipleRootElements()

Checks whether the root element has already been processed.

protected void
checkNotation(String
the name of the Notation to check
notName
)

Checks if a Notation with the given name was declared in the DTD of the document for the current pipeline.

protected void
checkUnparsedEntity(String
the name of the UnparsedEntity to check
entName
)

Checks if an UnparsedEntity with the given name was declared in the DTD of the document for the current pipeline.

private void
checkWhitespace(XMLString
the text to check
value
)

Checks whether the string only contains white space characters.

public void
protected void
protected void
private void
private void
private XMLInputSource
createInputSource(String publicId, String systemId, String baseSystemId, String accept, String acceptLanguage)

Returns a new XMLInputSource from the given parameters.

public void
doctypeDecl(String rootElement, String publicId, String systemId, Augmentations augs)

Implements com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler.doctypeDecl.

Notifies of the presence of the DOCTYPE line in the document.

public void
elementDecl(String name, String contentModel, Augmentations augmentations)

Implements com.sun.org.apache.xerces.internal.xni.XMLDTDHandler.elementDecl.

An element declaration.

public void
public void
endAttlist(Augmentations augmentations)

Implements com.sun.org.apache.xerces.internal.xni.XMLDTDHandler.endAttlist.

The end of an attribute list.

public void
public void
endConditional(Augmentations augmentations)

Implements com.sun.org.apache.xerces.internal.xni.XMLDTDHandler.endConditional.

The end of a conditional section.

public void
public void
public void
public void
public void
endGeneralEntity(String name, Augmentations augs)

Implements com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler.endGeneralEntity.

This method notifies the end of a general entity.

public void
endParameterEntity(String name, Augmentations augmentations)

Implements com.sun.org.apache.xerces.internal.xni.XMLDTDHandler.endParameterEntity.

This method notifies the end of a parameter entity.

private String
public void
public String

Returns:

the base URI
getBaseURI
(int depth)

Gets the base URI that was in use at that depth

public XMLDocumentHandler
public XMLDocumentSource
public XMLDTDHandler
public XMLDTDSource
public Boolean
getFeatureDefault(String
The feature identifier.
featureId
)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getFeatureDefault.

Returns the default state for a feature, or null if this component does not want to report a default value for this feature.

private String

Returns:

the base URI of the include parent.
getIncludeParentBaseURI
()

Returns the [base URI] of the include parent.

private int

Returns:

the depth of the top level include element
getIncludeParentDepth
()

Returns the depth of the include parent.

private String

Returns:

the language property of the include parent.
getIncludeParentLanguage
()

Returns the [language] of the include parent.

public String

Returns:

the language
getLanguage
(int depth)

Gets the language that was in use at that depth.

public Object
getPropertyDefault(String
The property identifier.
propertyId
)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getPropertyDefault.

Returns the default state for a property, or null if this component does not want to report a default value for this property.

public String[]
getRecognizedFeatures()

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getRecognizedFeatures.

Returns a list of feature identifiers that are recognized by this component.

public String[]
getRecognizedProperties()

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getRecognizedProperties.

Returns a list of property identifiers that are recognized by this component.

protected String

Returns:

the relative URI
getRelativeBaseURI
()

Returns a URI, relative to the include parent's base URI, of the current [base URI].

public String

Returns:

a relative URI to convert the base URI at the given depth to the current base URI
getRelativeURI
(int
the depth at which to start creating the relative URI
depth
)

Returns a relative URI, which when resolved against the base URI at the specified depth, will create the current base URI.

private int
getResultDepth()

Returns the current element depth of the result infoset.

private boolean
getRootElementProcessed()

Returns whether the root element has been processed.

protected boolean
getSawFallback(int depth)

Returns whether an <fallback> was encountered at the specified depth, as an ancestor of the current element, or as a sibling of an ancestor of the current element.

protected boolean

Returns:

true if an include was seen at the given depth, false otherwise
getSawInclude
(int depth)

Return whether an <include> was encountered at the specified depth, as an ancestor of the current item.

protected int
getState(int depth)

protected int
protected void
protected boolean
protected boolean

Returns:

true if the element has the namespace "http://www.w3.org/2001/XInclude"
hasXIncludeNamespace
(QName
the element to check
element
)

Returns true if the element has the namespace "http://www.w3.org/2001/XInclude"

public void
public void
ignoredCharacters(XMLString text, Augmentations augmentations)

Implements com.sun.org.apache.xerces.internal.xni.XMLDTDHandler.ignoredCharacters.

Characters within an IGNORE conditional section.

public void
internalEntityDecl(String name, XMLString text, XMLString nonNormalizedText, Augmentations augmentations)

Implements com.sun.org.apache.xerces.internal.xni.XMLDTDHandler.internalEntityDecl.

An internal entity declaration.

protected boolean

Returns:

true if the element is an <fallback; element
isFallbackElement
(QName
the element to check
element
)

Checks if the element is an <fallback> element.

protected boolean

Returns:

true if the element is an <include> element
isIncludeElement
(QName
the element to check
element
)

Checks if the element is an <include> element.

protected boolean
protected boolean

Returns:

true if the current element is a top level included item
isTopLevelIncludedItem
()

Returns true if the current element is a top level included item.

protected boolean
protected boolean
private boolean

Returns:

true if the given string would be valid in an HTTP header
isValidInHTTPHeader
(String
string to check
value
)

Returns true if the given string would be valid in an HTTP header.

protected Augmentations

Returns:

the modified Augmentations
modifyAugmentations
(Augmentations
the Augmentations to modify.
augs
)

Modify the augmentations.

protected Augmentations

Returns:

the modified Augmentations
modifyAugmentations
(Augmentations
the Augmentations to modify.
augs
,
boolean
whether to force modification
force
)

Modify the augmentations.

public void
protected XMLAttributes

Returns:

the processed XMLAttributes
processAttributes
(XMLAttributes attributes)

Processes the XMLAttributes object of startElement() calls.

public void
protected void
processXMLBaseAttributes(XMLAttributes attributes)

Search for a xml:base attribute, and if one is found, put the new base URI into effect.

protected void
processXMLLangAttributes(XMLAttributes attributes)

Search for a xml:lang attribute, and if one is found, put the new [language] into effect.

private void
reportError(String key, Object[] args, short severity, Exception exception)

protected void
protected void
protected void
reportFatalError(String key, Object[] args, Exception exception)

protected void
protected void
protected void
reportResourceError(String key, Object[] args, Exception exception)

public void
protected void
restoreBaseURI()

Discards the URIs at the top of the stack, and restores the ones beneath it.

public String
restoreLanguage()

Discards the language at the top of the stack, and returns the one beneath it.

protected boolean

Returns:

true if the [base URIs] are the same string
sameBaseURIAsIncludeParent
()

Returns true if the current [base URI] is the same as the [base URI] that was in effect on the include parent.

protected boolean

Returns:

true if the [language] properties have the same value taking case-insensitivity into account as per [RFC 3066].
sameLanguageAsIncludeParent
()

Returns true if the current [language] is equivalent to the [language] that was in effect on the include parent, taking case-insensitivity into account as per [RFC 3066].

protected void
saveBaseURI()

Saves the current base URI to the top of the stack.

protected void
saveLanguage(String
the language to push onto the stack.
language
)

Saves the given language on the top of the stack.

private int
scopeOfBaseURI(int depth)

private int
scopeOfLanguage(int depth)

protected boolean

Returns:

true if the source has already been included
searchForRecursiveIncludes
(String
the system id to check for inclusion
includedSysId
)

Checks if the file indicated by the given system id has already been included in the current stack.

public void
public void
public void
public void
private void
public void
setFeature(String
The feature identifier.
featureId
,
boolean
The state of the feature.
state
)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.setFeature.

Sets the state of a feature.

protected void
protected void
setParent(XIncludeHandler parent)

Set the parent of this XIncludeHandler in the tree

public void
setProperty(String
The property identifier.
propertyId
,
Object
The value of the property.
value
)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.setProperty.

Sets the value of a property.

private void
setRootElementProcessed(boolean seenRoot)

Sets whether the root element has been processed.

protected void
setSawFallback(int depth, boolean val)

Records that an <fallback> was encountered at the specified depth, as an ancestor of the current element, or as a sibling of an ancestor of the current element.

protected void
setSawInclude(int depth, boolean val)

Records that an <include> was encountered at the specified depth, as an ancestor of the current item.

protected void
setState(int state)

private void
protected void
public void
startAttlist(String elementName, Augmentations augmentations)

Implements com.sun.org.apache.xerces.internal.xni.XMLDTDHandler.startAttlist.

The start of an attribute list.

public void
public void
startConditional(short type, Augmentations augmentations)

Implements com.sun.org.apache.xerces.internal.xni.XMLDTDHandler.startConditional.

The start of a conditional section.

public void
startDocument(XMLLocator locator, String encoding, NamespaceContext namespaceContext, Augmentations augs)

Implements com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler.startDocument.

Event sent at the start of the document.

public void
public void
public void
public void
startGeneralEntity(String name, XMLResourceIdentifier resId, String encoding, Augmentations augs)

Implements com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler.startGeneralEntity.

This method notifies the start of a general entity.

public void
startParameterEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augmentations)

Implements com.sun.org.apache.xerces.internal.xni.XMLDTDHandler.startParameterEntity.

This method notifies of the start of a parameter entity.

public void
public void
unparsedEntityDecl(String name, XMLResourceIdentifier identifier, String notation, Augmentations augmentations)

Implements com.sun.org.apache.xerces.internal.xni.XMLDTDHandler.unparsedEntityDecl.

An unparsed entity declaration.

public void
xmlDecl(String version, String encoding, String standalone, Augmentations augs)

Implements com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler.xmlDecl.

Notifies of the presence of an XMLDecl line in the document.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait