org.apache.xerces.xinclude

Class XIncludeHandler

Implemented Interfaces:
org.apache.xerces.xni.parser.XMLComponent, org.apache.xerces.xni.parser.XMLDocumentFilter, org.apache.xerces.xni.parser.XMLDTDFilter

public class XIncludeHandler
extends java.lang.Object
implements org.apache.xerces.xni.parser.XMLComponent, org.apache.xerces.xni.parser.XMLDocumentFilter, org.apache.xerces.xni.parser.XMLDTDFilter

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/2003/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:

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.

Version:
$Id: XIncludeHandler.java,v 1.21 2004/02/17 07:14:49 neeraj Exp $

Author:
Peter McCracken, IBM

See Also:
XIncludeNamespaceSupport

Nested Class Summary

protected class
XIncludeHandler.Notation
protected class
XIncludeHandler.UnparsedEntity

Field Summary

protected static String
ALLOW_UE_AND_NOTATION_EVENTS
Feature identifier: allow notation and unparsed entity events to be sent out of order.
static String
CURRENT_BASE_URI
The identifier for the Augmentation that contains the current base URI
protected static String
ENTITY_RESOLVER
Property identifier: entity resolver.
protected static String
ERROR_REPORTER
Property identifier: error reporter.
static String
HTTP_ACCEPT
static String
HTTP_ACCEPT_CHARSET
static String
HTTP_ACCEPT_LANGUAGE
static org.apache.xerces.xni.QName
NEW_NS_ATTR_QNAME
protected static String
SECURITY_MANAGER
property identifier: security manager.
static String
XINCLUDE_ATTR_ACCEPT
static String
XINCLUDE_ATTR_ACCEPT_CHARSET
static String
XINCLUDE_ATTR_ACCEPT_LANGUAGE
static String
XINCLUDE_ATTR_ENCODING
static String
XINCLUDE_ATTR_HREF
static String
XINCLUDE_ATTR_PARSE
static String
XINCLUDE_BASE
static String
XINCLUDE_DEFAULT_CONFIGURATION
static String
XINCLUDE_FALLBACK
static String
XINCLUDE_INCLUDE
static String
XINCLUDE_INCLUDED
static String
XINCLUDE_NS_URI
static String
XINCLUDE_NS_URI_OLD
static String
XINCLUDE_PARSE_TEXT
static String
XINCLUDE_PARSE_XML
static org.apache.xerces.xni.QName
XML_BASE_QNAME
static String
XPOINTER
protected Stack
baseURI
protected IntStack
baseURIScope
protected Stack
expandedSystemID
protected org.apache.xerces.xni.parser.XMLParserConfiguration
fChildConfig
protected org.apache.xerces.xni.XMLResourceIdentifier
fCurrentBaseURI
protected org.apache.xerces.xni.XMLDTDHandler
fDTDHandler
protected org.apache.xerces.xni.parser.XMLDTDSource
fDTDSource
protected org.apache.xerces.xni.XMLLocator
fDocLocation
protected org.apache.xerces.xni.XMLDocumentHandler
fDocumentHandler
protected org.apache.xerces.xni.parser.XMLDocumentSource
fDocumentSource
protected org.apache.xerces.xni.parser.XMLEntityResolver
fEntityResolver
protected XMLErrorReporter
fErrorReporter
protected XIncludeNamespaceSupport
fNamespaceContext
protected String
fParentRelativeURI
protected XIncludeHandler
fParentXIncludeHandler
protected SecurityManager
fSecurityManager
protected ParserConfigurationSettings
fSettings
protected Stack
literalSystemID

Constructor Summary

XIncludeHandler()

Method Summary

protected void
addNotation(String name, org.apache.xerces.xni.XMLResourceIdentifier identifier, org.apache.xerces.xni.Augmentations augmentations)
Caches a notation.
protected void
addUnparsedEntity(String name, org.apache.xerces.xni.XMLResourceIdentifier identifier, String notation, org.apache.xerces.xni.Augmentations augmentations)
Caches an unparsed entity.
void
attributeDecl(String elementName, String attributeName, String type, String[] enumeration, String defaultType, org.apache.xerces.xni.XMLString defaultValue, org.apache.xerces.xni.XMLString nonNormalizedDefaultValue, org.apache.xerces.xni.Augmentations augmentations)
void
characters(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs)
protected void
checkAndSendNotation(XIncludeHandler.Notation 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 ent)
The purpose of this method is to check if an UnparsedEntity conflicts with a previously declared entity in the current pipeline stack.
protected void
checkNotation(String 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 entName)
Checks if an UnparsedEntity with the given name was declared in the DTD of the document for the current pipeline.
void
comment(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs)
protected void
copyFeatures(org.apache.xerces.xni.parser.XMLComponentManager from, ParserConfigurationSettings to)
protected void
copyFeatures(org.apache.xerces.xni.parser.XMLComponentManager from, org.apache.xerces.xni.parser.XMLParserConfiguration to)
void
doctypeDecl(String rootElement, String publicId, String systemId, org.apache.xerces.xni.Augmentations augs)
void
elementDecl(String name, String contentModel, org.apache.xerces.xni.Augmentations augmentations)
void
emptyElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs)
void
endAttlist(org.apache.xerces.xni.Augmentations augmentations)
void
endCDATA(org.apache.xerces.xni.Augmentations augs)
void
endConditional(org.apache.xerces.xni.Augmentations augmentations)
void
endDTD(org.apache.xerces.xni.Augmentations augmentations)
void
endDocument(org.apache.xerces.xni.Augmentations augs)
void
endElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.Augmentations augs)
void
endExternalSubset(org.apache.xerces.xni.Augmentations augmentations)
void
endGeneralEntity(String name, org.apache.xerces.xni.Augmentations augs)
void
endParameterEntity(String name, org.apache.xerces.xni.Augmentations augmentations)
void
externalEntityDecl(String name, org.apache.xerces.xni.XMLResourceIdentifier identifier, org.apache.xerces.xni.Augmentations augmentations)
String
getBaseURI(int depth)
Gets the base URI that was in use at that depth
org.apache.xerces.xni.XMLDTDHandler
getDTDHandler()
org.apache.xerces.xni.parser.XMLDTDSource
getDTDSource()
org.apache.xerces.xni.XMLDocumentHandler
getDocumentHandler()
org.apache.xerces.xni.parser.XMLDocumentSource
getDocumentSource()
Boolean
getFeatureDefault(String featureId)
Returns the default state for a feature, or null if this component does not want to report a default value for this feature.
Object
getPropertyDefault(String propertyId)
Returns the default state for a property, or null if this component does not want to report a default value for this property.
String[]
getRecognizedFeatures()
Returns a list of feature identifiers that are recognized by this component.
String[]
getRecognizedProperties()
Returns a list of property identifiers that are recognized by this component.
protected String
getRelativeBaseURI()
Returns a URI, relative to the include parent's base URI, of the current [base URI].
String
getRelativeURI(int depth)
Returns a relative URI, which when resolved against the base URI at the specified depth, will create the current base URI.
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
getSawInclude(int depth)
Return whether an <include> was encountered at the specified depth, as an ancestor of the current item.
protected int
getState()
protected int
getState(int depth)
protected void
handleFallbackElement()
protected boolean
handleIncludeElement(org.apache.xerces.xni.XMLAttributes attributes)
protected boolean
hasXInclude2001Namespace(org.apache.xerces.xni.QName element)
Returns true if the element has the namespace "http://www.w3.org/2001/XInclude"
protected boolean
hasXIncludeNamespace(org.apache.xerces.xni.QName element)
Returns true if the element has the namespace "http://www.w3.org/2003/XInclude"
void
ignorableWhitespace(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs)
void
ignoredCharacters(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augmentations)
void
internalEntityDecl(String name, org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.XMLString nonNormalizedText, org.apache.xerces.xni.Augmentations augmentations)
protected boolean
isFallbackElement(org.apache.xerces.xni.QName element)
Checks if the element is an <fallback> element.
protected boolean
isIncludeElement(org.apache.xerces.xni.QName element)
Checks if the element is an <include> element.
protected boolean
isRootDocument()
protected boolean
isTopLevelIncludedItem()
Returns true if the current element is a top level included item.
protected boolean
isTopLevelIncludedItemViaFallback()
protected boolean
isTopLevelIncludedItemViaInclude()
protected org.apache.xerces.xni.Augmentations
modifyAugmentations(org.apache.xerces.xni.Augmentations augs)
Modify the augmentations.
protected org.apache.xerces.xni.Augmentations
modifyAugmentations(org.apache.xerces.xni.Augmentations augs, boolean force)
Modify the augmentations.
void
notationDecl(String name, org.apache.xerces.xni.XMLResourceIdentifier identifier, org.apache.xerces.xni.Augmentations augmentations)
protected org.apache.xerces.xni.XMLAttributes
processAttributes(org.apache.xerces.xni.XMLAttributes attributes)
Processes the XMLAttributes object of startElement() calls.
protected void
processXMLBaseAttributes(org.apache.xerces.xni.XMLAttributes attributes)
Search for a xml:base attribute, and if one is found, put the new base URI into effect.
void
processingInstruction(String target, org.apache.xerces.xni.XMLString data, org.apache.xerces.xni.Augmentations augs)
protected void
reportFatalError(String key)
protected void
reportFatalError(String key, Object[] args)
protected void
reportResourceError(String key)
protected void
reportResourceError(String key, Object[] args)
void
reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
protected void
restoreBaseURI()
Discards the URIs at the top of the stack, and restores the ones beneath it.
protected boolean
sameBaseURIAsIncludeParent()
Returns true if the current [base URI] is the same as the [base URI] that was in effect on the include parent.
protected void
saveBaseURI()
Saves the current base URI to the top of the stack.
protected boolean
searchForRecursiveIncludes(org.apache.xerces.xni.XMLLocator includedSource)
Checks if the file indicated by the given XMLLocator has already been included in the current stack.
void
setDTDHandler(org.apache.xerces.xni.XMLDTDHandler handler)
void
setDTDSource(org.apache.xerces.xni.parser.XMLDTDSource source)
void
setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler handler)
void
setDocumentSource(org.apache.xerces.xni.parser.XMLDocumentSource source)
void
setFeature(String featureId, boolean state)
Sets the state of a feature.
protected void
setParent(XIncludeHandler parent)
Set the parent of this XIncludeHandler in the tree
void
setProperty(String propertyId, Object value)
Sets the value of a property.
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)
void
startAttlist(String elementName, org.apache.xerces.xni.Augmentations augmentations)
void
startCDATA(org.apache.xerces.xni.Augmentations augs)
void
startConditional(short type, org.apache.xerces.xni.Augmentations augmentations)
void
startDTD(org.apache.xerces.xni.XMLLocator locator, org.apache.xerces.xni.Augmentations augmentations)
void
startDocument(org.apache.xerces.xni.XMLLocator locator, String encoding, org.apache.xerces.xni.NamespaceContext namespaceContext, org.apache.xerces.xni.Augmentations augs)
Event sent at the start of the document.
void
startElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs)
void
startExternalSubset(org.apache.xerces.xni.XMLResourceIdentifier identifier, org.apache.xerces.xni.Augmentations augmentations)
void
startGeneralEntity(String name, org.apache.xerces.xni.XMLResourceIdentifier resId, String encoding, org.apache.xerces.xni.Augmentations augs)
void
startParameterEntity(String name, org.apache.xerces.xni.XMLResourceIdentifier identifier, String encoding, org.apache.xerces.xni.Augmentations augmentations)
void
textDecl(String version, String encoding, org.apache.xerces.xni.Augmentations augs)
void
unparsedEntityDecl(String name, org.apache.xerces.xni.XMLResourceIdentifier identifier, String notation, org.apache.xerces.xni.Augmentations augmentations)
void
xmlDecl(String version, String encoding, String standalone, org.apache.xerces.xni.Augmentations augs)

Field Details

ALLOW_UE_AND_NOTATION_EVENTS

protected static final String ALLOW_UE_AND_NOTATION_EVENTS
Feature identifier: allow notation and unparsed entity events to be sent out of order.


CURRENT_BASE_URI

public static final String CURRENT_BASE_URI
The identifier for the Augmentation that contains the current base URI


ENTITY_RESOLVER

protected static final String ENTITY_RESOLVER
Property identifier: entity resolver.


ERROR_REPORTER

protected static final String ERROR_REPORTER
Property identifier: error reporter.


HTTP_ACCEPT

public static final String HTTP_ACCEPT


HTTP_ACCEPT_CHARSET

public static final String HTTP_ACCEPT_CHARSET


HTTP_ACCEPT_LANGUAGE

public static final String HTTP_ACCEPT_LANGUAGE


NEW_NS_ATTR_QNAME

public static final org.apache.xerces.xni.QName NEW_NS_ATTR_QNAME


SECURITY_MANAGER

protected static final String SECURITY_MANAGER
property identifier: security manager.


XINCLUDE_ATTR_ACCEPT

public static final String XINCLUDE_ATTR_ACCEPT


XINCLUDE_ATTR_ACCEPT_CHARSET

public static final String XINCLUDE_ATTR_ACCEPT_CHARSET


XINCLUDE_ATTR_ACCEPT_LANGUAGE

public static final String XINCLUDE_ATTR_ACCEPT_LANGUAGE


XINCLUDE_ATTR_ENCODING

public static final String XINCLUDE_ATTR_ENCODING


XINCLUDE_ATTR_HREF

public static final String XINCLUDE_ATTR_HREF


XINCLUDE_ATTR_PARSE

public static final String XINCLUDE_ATTR_PARSE


XINCLUDE_BASE

public static final String XINCLUDE_BASE


XINCLUDE_DEFAULT_CONFIGURATION

public static final String XINCLUDE_DEFAULT_CONFIGURATION


XINCLUDE_FALLBACK

public static final String XINCLUDE_FALLBACK


XINCLUDE_INCLUDE

public static final String XINCLUDE_INCLUDE


XINCLUDE_INCLUDED

public static final String XINCLUDE_INCLUDED


XINCLUDE_NS_URI

public static final String XINCLUDE_NS_URI


XINCLUDE_NS_URI_OLD

public static final String XINCLUDE_NS_URI_OLD


XINCLUDE_PARSE_TEXT

public static final String XINCLUDE_PARSE_TEXT


XINCLUDE_PARSE_XML

public static final String XINCLUDE_PARSE_XML


XML_BASE_QNAME

public static final org.apache.xerces.xni.QName XML_BASE_QNAME


XPOINTER

public static final String XPOINTER


baseURI

protected Stack baseURI


baseURIScope

protected IntStack baseURIScope


expandedSystemID

protected Stack expandedSystemID


fChildConfig

protected org.apache.xerces.xni.parser.XMLParserConfiguration fChildConfig


fCurrentBaseURI

protected org.apache.xerces.xni.XMLResourceIdentifier fCurrentBaseURI


fDTDHandler

protected org.apache.xerces.xni.XMLDTDHandler fDTDHandler


fDTDSource

protected org.apache.xerces.xni.parser.XMLDTDSource fDTDSource


fDocLocation

protected org.apache.xerces.xni.XMLLocator fDocLocation


fDocumentHandler

protected org.apache.xerces.xni.XMLDocumentHandler fDocumentHandler


fDocumentSource

protected org.apache.xerces.xni.parser.XMLDocumentSource fDocumentSource


fEntityResolver

protected org.apache.xerces.xni.parser.XMLEntityResolver fEntityResolver


fErrorReporter

protected XMLErrorReporter fErrorReporter


fNamespaceContext

protected XIncludeNamespaceSupport fNamespaceContext


fParentRelativeURI

protected String fParentRelativeURI


fParentXIncludeHandler

protected XIncludeHandler fParentXIncludeHandler


fSecurityManager

protected SecurityManager fSecurityManager


fSettings

protected ParserConfigurationSettings fSettings


literalSystemID

protected Stack literalSystemID

Constructor Details

XIncludeHandler

public XIncludeHandler()

Method Details

addNotation

protected void addNotation(String name,
                           org.apache.xerces.xni.XMLResourceIdentifier identifier,
                           org.apache.xerces.xni.Augmentations augmentations)
Caches a notation.

Parameters:
name - the name of the notation
identifier - the location of the notation
augmentations - any Augmentations that were on the original notation declaration


addUnparsedEntity

protected void addUnparsedEntity(String name,
                                 org.apache.xerces.xni.XMLResourceIdentifier identifier,
                                 String notation,
                                 org.apache.xerces.xni.Augmentations augmentations)
Caches an unparsed entity.

Parameters:
name - the name of the unparsed entity
identifier - the location of the unparsed entity
augmentations - any Augmentations that were on the original unparsed entity declaration


attributeDecl

public void attributeDecl(String elementName,
                          String attributeName,
                          String type,
                          String[] enumeration,
                          String defaultType,
                          org.apache.xerces.xni.XMLString defaultValue,
                          org.apache.xerces.xni.XMLString nonNormalizedDefaultValue,
                          org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
attributeDecl in interface org.apache.xerces.xni.XMLDTDHandler


characters

public void characters(org.apache.xerces.xni.XMLString text,
                       org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
characters in interface org.apache.xerces.xni.XMLDocumentHandler


checkAndSendNotation

protected void checkAndSendNotation(XIncludeHandler.Notation not)
The purpose of this method is to check if a Notation conflicts with a previously declared notation in the current pipeline stack. If there is no conflict, the Notation is sent by the root pipeline.

Parameters:
not - the Notation to check for conflicts


checkAndSendUnparsedEntity

protected void checkAndSendUnparsedEntity(XIncludeHandler.UnparsedEntity ent)
The purpose of this method is to check if an UnparsedEntity conflicts with a previously declared entity in the current pipeline stack. If there is no conflict, the UnparsedEntity is sent by the root pipeline.

Parameters:
ent - the UnparsedEntity to check for conflicts


checkNotation

protected void checkNotation(String notName)
Checks if a Notation with the given name was declared in the DTD of the document for the current pipeline. If so, that Notation is passed to the root pipeline to be checked for conflicts, and sent to the root DTDHandler

Parameters:
notName - the name of the Notation to check


checkUnparsedEntity

protected void checkUnparsedEntity(String entName)
Checks if an UnparsedEntity with the given name was declared in the DTD of the document for the current pipeline. If so, then the notation for the UnparsedEntity is checked. If that turns out okay, then the UnparsedEntity is passed to the root pipeline to be checked for conflicts, and sent to the root DTDHandler.

Parameters:
entName - the name of the UnparsedEntity to check


comment

public void comment(org.apache.xerces.xni.XMLString text,
                    org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
comment in interface org.apache.xerces.xni.XMLDocumentHandler
comment in interface org.apache.xerces.xni.XMLDTDHandler


copyFeatures

protected void copyFeatures(org.apache.xerces.xni.parser.XMLComponentManager from,
                            ParserConfigurationSettings to)


copyFeatures

protected void copyFeatures(org.apache.xerces.xni.parser.XMLComponentManager from,
                            org.apache.xerces.xni.parser.XMLParserConfiguration to)


doctypeDecl

public void doctypeDecl(String rootElement,
                        String publicId,
                        String systemId,
                        org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
doctypeDecl in interface org.apache.xerces.xni.XMLDocumentHandler


elementDecl

public void elementDecl(String name,
                        String contentModel,
                        org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
elementDecl in interface org.apache.xerces.xni.XMLDTDHandler


emptyElement

public void emptyElement(org.apache.xerces.xni.QName element,
                         org.apache.xerces.xni.XMLAttributes attributes,
                         org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
emptyElement in interface org.apache.xerces.xni.XMLDocumentHandler


endAttlist

public void endAttlist(org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
endAttlist in interface org.apache.xerces.xni.XMLDTDHandler


endCDATA

public void endCDATA(org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
endCDATA in interface org.apache.xerces.xni.XMLDocumentHandler


endConditional

public void endConditional(org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
endConditional in interface org.apache.xerces.xni.XMLDTDHandler


endDTD

public void endDTD(org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
endDTD in interface org.apache.xerces.xni.XMLDTDHandler


endDocument

public void endDocument(org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
endDocument in interface org.apache.xerces.xni.XMLDocumentHandler


endElement

public void endElement(org.apache.xerces.xni.QName element,
                       org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
endElement in interface org.apache.xerces.xni.XMLDocumentHandler


endExternalSubset

public void endExternalSubset(org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
endExternalSubset in interface org.apache.xerces.xni.XMLDTDHandler


endGeneralEntity

public void endGeneralEntity(String name,
                             org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
endGeneralEntity in interface org.apache.xerces.xni.XMLDocumentHandler


endParameterEntity

public void endParameterEntity(String name,
                               org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
endParameterEntity in interface org.apache.xerces.xni.XMLDTDHandler


externalEntityDecl

public void externalEntityDecl(String name,
                               org.apache.xerces.xni.XMLResourceIdentifier identifier,
                               org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
externalEntityDecl in interface org.apache.xerces.xni.XMLDTDHandler


getBaseURI

public String getBaseURI(int depth)
Gets the base URI that was in use at that depth

Parameters:
depth -

Returns:
the base URI


getDTDHandler

public org.apache.xerces.xni.XMLDTDHandler getDTDHandler()
Specified by:
getDTDHandler in interface org.apache.xerces.xni.parser.XMLDTDSource


getDTDSource

public org.apache.xerces.xni.parser.XMLDTDSource getDTDSource()
Specified by:
getDTDSource in interface org.apache.xerces.xni.XMLDTDHandler


getDocumentHandler

public org.apache.xerces.xni.XMLDocumentHandler getDocumentHandler()
Specified by:
getDocumentHandler in interface org.apache.xerces.xni.parser.XMLDocumentSource


getDocumentSource

public org.apache.xerces.xni.parser.XMLDocumentSource getDocumentSource()
Specified by:
getDocumentSource in interface org.apache.xerces.xni.XMLDocumentHandler


getFeatureDefault

public Boolean getFeatureDefault(String featureId)
Returns the default state for a feature, or null if this component does not want to report a default value for this feature.
Specified by:
getFeatureDefault in interface org.apache.xerces.xni.parser.XMLComponent

Parameters:
featureId - The feature identifier.

Since:
Xerces 2.2.0


getPropertyDefault

public Object getPropertyDefault(String propertyId)
Returns the default state for a property, or null if this component does not want to report a default value for this property.
Specified by:
getPropertyDefault in interface org.apache.xerces.xni.parser.XMLComponent

Parameters:
propertyId - The property identifier.

Since:
Xerces 2.2.0


getRecognizedFeatures

public String[] getRecognizedFeatures()
Returns a list of feature identifiers that are recognized by this component. This method may return null if no features are recognized by this component.
Specified by:
getRecognizedFeatures in interface org.apache.xerces.xni.parser.XMLComponent


getRecognizedProperties

public String[] getRecognizedProperties()
Returns a list of property identifiers that are recognized by this component. This method may return null if no properties are recognized by this component.
Specified by:
getRecognizedProperties in interface org.apache.xerces.xni.parser.XMLComponent


getRelativeBaseURI

protected String getRelativeBaseURI()
            throws URI.MalformedURIException
Returns a URI, relative to the include parent's base URI, of the current [base URI]. For instance, if the current [base URI] was "dir1/dir2/file.xml" and the include parent's [base URI] was "dir/", this would return "dir2/file.xml".

Returns:
the relative URI


getRelativeURI

public String getRelativeURI(int depth)
            throws URI.MalformedURIException
Returns a relative URI, which when resolved against the base URI at the specified depth, will create the current base URI. This is accomplished by merged the literal system IDs.

Parameters:
depth - the depth at which to start creating the relative URI

Returns:
a relative URI to convert the base URI at the given depth to the current base URI


getSawFallback

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.

Parameters:
depth -


getSawInclude

protected boolean getSawInclude(int depth)
Return whether an <include> was encountered at the specified depth, as an ancestor of the current item.

Parameters:
depth -

Returns:


getState

protected int getState()


getState

protected int getState(int depth)


handleFallbackElement

protected void handleFallbackElement()


handleIncludeElement

protected boolean handleIncludeElement(org.apache.xerces.xni.XMLAttributes attributes)
            throws org.apache.xerces.xni.XNIException


hasXInclude2001Namespace

protected boolean hasXInclude2001Namespace(org.apache.xerces.xni.QName element)
Returns true if the element has the namespace "http://www.w3.org/2001/XInclude"

Parameters:
element - the element to check

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


hasXIncludeNamespace

protected boolean hasXIncludeNamespace(org.apache.xerces.xni.QName element)
Returns true if the element has the namespace "http://www.w3.org/2003/XInclude"

Parameters:
element - the element to check

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


ignorableWhitespace

public void ignorableWhitespace(org.apache.xerces.xni.XMLString text,
                                org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
ignorableWhitespace in interface org.apache.xerces.xni.XMLDocumentHandler


ignoredCharacters

public void ignoredCharacters(org.apache.xerces.xni.XMLString text,
                              org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
ignoredCharacters in interface org.apache.xerces.xni.XMLDTDHandler


internalEntityDecl

public void internalEntityDecl(String name,
                               org.apache.xerces.xni.XMLString text,
                               org.apache.xerces.xni.XMLString nonNormalizedText,
                               org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
internalEntityDecl in interface org.apache.xerces.xni.XMLDTDHandler


isFallbackElement

protected boolean isFallbackElement(org.apache.xerces.xni.QName element)
Checks if the element is an <fallback> element. The element must have the XInclude namespace, and a local name of "fallback". If the local name is "fallback" and the namespace name is the old XInclude namespace "http://www.w3.org/2001/XInclude" a warning is issued the first time an element from the old namespace is encountered.

Parameters:
element - the element to check

Returns:
true if the element is an <fallback; element

See Also:
hasXIncludeNamespace(QName)


isIncludeElement

protected boolean isIncludeElement(org.apache.xerces.xni.QName element)
Checks if the element is an <include> element. The element must have the XInclude namespace, and a local name of "include". If the local name is "include" and the namespace name is the old XInclude namespace "http://www.w3.org/2001/XInclude" a warning is issued the first time an element from the old namespace is encountered.

Parameters:
element - the element to check

Returns:
true if the element is an <include> element

See Also:
hasXIncludeNamespace(QName)


isRootDocument

protected boolean isRootDocument()


isTopLevelIncludedItem

protected boolean isTopLevelIncludedItem()
Returns true if the current element is a top level included item. This means it's either the child of a fallback element, or the top level item in an included document

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


isTopLevelIncludedItemViaFallback

protected boolean isTopLevelIncludedItemViaFallback()


isTopLevelIncludedItemViaInclude

protected boolean isTopLevelIncludedItemViaInclude()


modifyAugmentations

protected org.apache.xerces.xni.Augmentations modifyAugmentations(org.apache.xerces.xni.Augmentations augs)
Modify the augmentations. Add an [included] infoset item, if the current element is a top level included item.

Parameters:
augs - the Augmentations to modify.

Returns:
the modified Augmentations


modifyAugmentations

protected org.apache.xerces.xni.Augmentations modifyAugmentations(org.apache.xerces.xni.Augmentations augs,
                                                                  boolean force)
Modify the augmentations. Add an [included] infoset item, if force is true, or if the current element is a top level included item.

Parameters:
augs - the Augmentations to modify.
force - whether to force modification

Returns:
the modified Augmentations


notationDecl

public void notationDecl(String name,
                         org.apache.xerces.xni.XMLResourceIdentifier identifier,
                         org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
notationDecl in interface org.apache.xerces.xni.XMLDTDHandler


processAttributes

protected org.apache.xerces.xni.XMLAttributes processAttributes(org.apache.xerces.xni.XMLAttributes attributes)
Processes the XMLAttributes object of startElement() calls. Performs the following tasks:
  • If the element is a top level included item whose [base URI] is different from the [base URI] of the include parent, then an xml:base attribute is added to specify the true [base URI]
  • For all namespace prefixes which are in-scope in an included item, but not in scope in the include parent, a xmlns:prefix attribute is added
  • For all attributes with a type of ENTITY, ENTITIES or NOTATIONS, the notations and unparsed entities are processed as described in the spec, sections 4.5.1 and 4.5.2

Parameters:
attributes -

Returns:


processXMLBaseAttributes

protected void processXMLBaseAttributes(org.apache.xerces.xni.XMLAttributes attributes)
Search for a xml:base attribute, and if one is found, put the new base URI into effect.


processingInstruction

public void processingInstruction(String target,
                                  org.apache.xerces.xni.XMLString data,
                                  org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
processingInstruction in interface org.apache.xerces.xni.XMLDocumentHandler
processingInstruction in interface org.apache.xerces.xni.XMLDTDHandler


reportFatalError

protected void reportFatalError(String key)


reportFatalError

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


reportResourceError

protected void reportResourceError(String key)


reportResourceError

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


reset

public void reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
            throws org.apache.xerces.xni.XNIException
Specified by:
reset in interface org.apache.xerces.xni.parser.XMLComponent


restoreBaseURI

protected void restoreBaseURI()
Discards the URIs at the top of the stack, and restores the ones beneath it.


sameBaseURIAsIncludeParent

protected boolean sameBaseURIAsIncludeParent()
Returns true if the current [base URI] is the same as the [base URI] that was in effect on the include parent. This method should only be called when the current element is a top level included element, i.e. the direct child of a fallback element, or the root elements in an included document. The "include parent" is the element which, in the result infoset, will be the direct parent of the current element.

Returns:
true if the [base URIs] are the same string


saveBaseURI

protected void saveBaseURI()
Saves the current base URI to the top of the stack.


searchForRecursiveIncludes

protected boolean searchForRecursiveIncludes(org.apache.xerces.xni.XMLLocator includedSource)
Checks if the file indicated by the given XMLLocator has already been included in the current stack.

Parameters:
includedSource - the source to check for inclusion

Returns:
true if the source has already been included


setDTDHandler

public void setDTDHandler(org.apache.xerces.xni.XMLDTDHandler handler)
Specified by:
setDTDHandler in interface org.apache.xerces.xni.parser.XMLDTDSource


setDTDSource

public void setDTDSource(org.apache.xerces.xni.parser.XMLDTDSource source)
Specified by:
setDTDSource in interface org.apache.xerces.xni.XMLDTDHandler


setDocumentHandler

public void setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler handler)
Specified by:
setDocumentHandler in interface org.apache.xerces.xni.parser.XMLDocumentSource


setDocumentSource

public void setDocumentSource(org.apache.xerces.xni.parser.XMLDocumentSource source)
Specified by:
setDocumentSource in interface org.apache.xerces.xni.XMLDocumentHandler


setFeature

public void setFeature(String featureId,
                       boolean state)
            throws org.apache.xerces.xni.parser.XMLConfigurationException
Sets the state of a feature. This method is called by the component manager any time after reset when a feature changes state.

Note: Components should silently ignore features that do not affect the operation of the component.

Specified by:
setFeature in interface org.apache.xerces.xni.parser.XMLComponent

Parameters:
featureId - The feature identifier.
state - The state of the feature.


setParent

protected void setParent(XIncludeHandler parent)
Set the parent of this XIncludeHandler in the tree

Parameters:
parent -


setProperty

public void setProperty(String propertyId,
                        Object value)
            throws org.apache.xerces.xni.parser.XMLConfigurationException
Sets the value of a property. This method is called by the component manager any time after reset when a property changes value.

Note: Components should silently ignore properties that do not affect the operation of the component.

Specified by:
setProperty in interface org.apache.xerces.xni.parser.XMLComponent

Parameters:
propertyId - The property identifier.
value - The value of the property.


setSawFallback

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.

Parameters:
depth -
val -


setSawInclude

protected void setSawInclude(int depth,
                             boolean val)
Records that an <include> was encountered at the specified depth, as an ancestor of the current item.

Parameters:
depth -
val -


setState

protected void setState(int state)


startAttlist

public void startAttlist(String elementName,
                         org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
startAttlist in interface org.apache.xerces.xni.XMLDTDHandler


startCDATA

public void startCDATA(org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
startCDATA in interface org.apache.xerces.xni.XMLDocumentHandler


startConditional

public void startConditional(short type,
                             org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
startConditional in interface org.apache.xerces.xni.XMLDTDHandler


startDTD

public void startDTD(org.apache.xerces.xni.XMLLocator locator,
                     org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
startDTD in interface org.apache.xerces.xni.XMLDTDHandler


startDocument

public void startDocument(org.apache.xerces.xni.XMLLocator locator,
                          String encoding,
                          org.apache.xerces.xni.NamespaceContext namespaceContext,
                          org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Event sent at the start of the document. A fatal error will occur here, if it is detected that this document has been processed before. This event is only passed on to the document handler if this is the root document.
Specified by:
startDocument in interface org.apache.xerces.xni.XMLDocumentHandler


startElement

public void startElement(org.apache.xerces.xni.QName element,
                         org.apache.xerces.xni.XMLAttributes attributes,
                         org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
startElement in interface org.apache.xerces.xni.XMLDocumentHandler


startExternalSubset

public void startExternalSubset(org.apache.xerces.xni.XMLResourceIdentifier identifier,
                                org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
startExternalSubset in interface org.apache.xerces.xni.XMLDTDHandler


startGeneralEntity

public void startGeneralEntity(String name,
                               org.apache.xerces.xni.XMLResourceIdentifier resId,
                               String encoding,
                               org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
startGeneralEntity in interface org.apache.xerces.xni.XMLDocumentHandler


startParameterEntity

public void startParameterEntity(String name,
                                 org.apache.xerces.xni.XMLResourceIdentifier identifier,
                                 String encoding,
                                 org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
startParameterEntity in interface org.apache.xerces.xni.XMLDTDHandler


textDecl

public void textDecl(String version,
                     String encoding,
                     org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
textDecl in interface org.apache.xerces.xni.XMLDocumentHandler
textDecl in interface org.apache.xerces.xni.XMLDTDHandler


unparsedEntityDecl

public void unparsedEntityDecl(String name,
                               org.apache.xerces.xni.XMLResourceIdentifier identifier,
                               String notation,
                               org.apache.xerces.xni.Augmentations augmentations)
            throws org.apache.xerces.xni.XNIException
Specified by:
unparsedEntityDecl in interface org.apache.xerces.xni.XMLDTDHandler


xmlDecl

public void xmlDecl(String version,
                    String encoding,
                    String standalone,
                    org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.XNIException
Specified by:
xmlDecl in interface org.apache.xerces.xni.XMLDocumentHandler


Copyright B) 1999-2004 Apache XML Project. All Rights Reserved.