Class XPointerHandler
- java.lang.Object
-
- org.apache.xerces.xinclude.XIncludeHandler
-
- org.apache.xerces.xpointer.XPointerHandler
-
- All Implemented Interfaces:
org.apache.xerces.xni.parser.XMLComponent,org.apache.xerces.xni.parser.XMLDocumentFilter,org.apache.xerces.xni.parser.XMLDocumentSource,org.apache.xerces.xni.parser.XMLDTDFilter,org.apache.xerces.xni.parser.XMLDTDSource,org.apache.xerces.xni.XMLDocumentHandler,org.apache.xerces.xni.XMLDTDHandler,XPointerProcessor
public final class XPointerHandler extends XIncludeHandler implements XPointerProcessor
This is a pipeline component which extends the XIncludeHandler to perform XPointer specific processing specified in the W3C XPointerFramework and element() Scheme Recommendations.
This component analyzes each event in the pipeline, looking for an element that matches a PointerPart in the parent XInclude element's xpointer attribute value. If the match succeeds, all children are passed by this component.
See the XPointer Framework Recommendation for more information on the XPointer Framework and ShortHand Pointers. See the XPointer element() Scheme Recommendation for more information on the XPointer element() Scheme.
INTERNAL:
- Usage of this class is not supported. It may be altered or removed at any time.
- Version:
- $Id: XPointerHandler.java 603808 2007-12-13 03:44:48Z mrglavas $
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.xerces.xinclude.XIncludeHandler
XIncludeHandler.Notation, XIncludeHandler.UnparsedEntity
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.xerces.xni.parser.XMLErrorHandlerfErrorHandlerprotected booleanfFixupBaseprotected booleanfFixupLangprotected booleanfFoundMatchingPtrPartprotected booleanfIsXPointerResolvedprotected SymbolTablefSymbolTableprotected XMLErrorReporterfXPointerErrorReporterprotected XPointerPartfXPointerPartprotected java.util.ArrayListfXPointerParts-
Fields inherited from class org.apache.xerces.xinclude.XIncludeHandler
ALLOW_UE_AND_NOTATION_EVENTS, BUFFER_SIZE, CURRENT_BASE_URI, DYNAMIC_VALIDATION, ENTITY_RESOLVER, ERROR_REPORTER, fBaseURI, fBaseURIScope, fBufferSize, fChildConfig, fCurrentBaseURI, fCurrentLanguage, fDocLocation, fDocumentHandler, fDocumentSource, fDTDHandler, fDTDSource, fEntityResolver, fErrorReporter, fExpandedSystemID, fHrefFromParent, fLanguageScope, fLanguageStack, fLiteralSystemID, fNamespaceContext, fParentRelativeURI, fParentXIncludeHandler, fSecurityManager, fSettings, fXInclude10TextReader, fXInclude11TextReader, fXIncludeChildConfig, fXIncludeLocator, fXIncludeMessageFormatter, fXPointerChildConfig, fXPtrProcessor, HTTP_ACCEPT, HTTP_ACCEPT_LANGUAGE, JAXP_SCHEMA_LANGUAGE, PARSER_SETTINGS, SCHEMA_VALIDATION, SECURITY_MANAGER, SYMBOL_TABLE, VALIDATION, XINCLUDE_ATTR_ACCEPT, XINCLUDE_ATTR_ACCEPT_LANGUAGE, XINCLUDE_ATTR_ENCODING, XINCLUDE_ATTR_HREF, XINCLUDE_ATTR_PARSE, XINCLUDE_DEFAULT_CONFIGURATION, XINCLUDE_FALLBACK, XINCLUDE_FIXUP_BASE_URIS, XINCLUDE_FIXUP_LANGUAGE, XINCLUDE_INCLUDE, XINCLUDE_INCLUDED, XINCLUDE_NS_URI, XINCLUDE_PARSE_TEXT, XINCLUDE_PARSE_XML, XPOINTER
-
Fields inherited from interface org.apache.xerces.xni.XMLDTDHandler
CONDITIONAL_IGNORE, CONDITIONAL_INCLUDE
-
Fields inherited from interface org.apache.xerces.xpointer.XPointerProcessor
EVENT_ELEMENT_EMPTY, EVENT_ELEMENT_END, EVENT_ELEMENT_START
-
-
Constructor Summary
Constructors Constructor Description XPointerHandler()XPointerHandler(SymbolTable symbolTable, org.apache.xerces.xni.parser.XMLErrorHandler errorHandler, XMLErrorReporter errorReporter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs)Character content.voidcomment(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs)If the comment is a child of a matched element, then pass else return.voidemptyElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs)An empty element.voidendCDATA(org.apache.xerces.xni.Augmentations augs)The end of a CDATA section.voidendElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.Augmentations augs)The end of an element.java.util.ArrayListgetPointerParts()Returns an ArrayList of XPointerPart objectsXPointerPartgetXPointerPart()Returns the pointer part used to resolve the document fragment.voidignorableWhitespace(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs)Ignorable whitespace.protected voidinit()Initializes the XPointer Processor;protected voidinitErrorReporter()Initializes error handling objectsbooleanisChildFragmentResolved()Returns true if the XPointer expression resolves to a non-element child of the current resource fragment.booleanisFragmentResolved()Returns true if the Node fragment is resolved.booleanisXPointerResolved()Returns true if the XPointer successfully found a sub-resource .voidparseXPointer(java.lang.String xpointer)Parses the XPointer framework expression and delegates scheme specific parsing.voidprocessingInstruction(java.lang.String target, org.apache.xerces.xni.XMLString data, org.apache.xerces.xni.Augmentations augs)A processing instruction.booleanresolveXPointer(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs, int event)Evaluates an XML resource with respect to an XPointer expressions by checking if it's element and attributes parameters match the criteria specified in the xpointer expression.voidsetDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler handler)Sets the document handler.voidsetProperty(java.lang.String propertyId, java.lang.Object value)Sets the value of a property.voidstartCDATA(org.apache.xerces.xni.Augmentations augs)The start of a CDATA section.voidstartElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs)The start of an element.-
Methods inherited from class org.apache.xerces.xinclude.XIncludeHandler
addNotation, addUnparsedEntity, attributeDecl, checkAndSendNotation, checkAndSendUnparsedEntity, checkNotation, checkUnparsedEntity, copyFeatures, copyFeatures, doctypeDecl, elementDecl, endAttlist, endConditional, endDocument, endDTD, endExternalSubset, endGeneralEntity, endParameterEntity, externalEntityDecl, getBaseURI, getDocumentHandler, getDocumentSource, getDTDHandler, getDTDSource, getFeatureDefault, getLanguage, getPropertyDefault, getRecognizedFeatures, getRecognizedProperties, getRelativeBaseURI, getRelativeURI, getSawFallback, getSawInclude, getState, getState, handleFallbackElement, handleIncludeElement, hasXIncludeNamespace, ignoredCharacters, internalEntityDecl, isFallbackElement, isIncludeElement, isRootDocument, isTopLevelIncludedItem, isTopLevelIncludedItemViaFallback, isTopLevelIncludedItemViaInclude, modifyAugmentations, modifyAugmentations, notationDecl, processAttributes, processXMLBaseAttributes, processXMLLangAttributes, reportFatalError, reportFatalError, reportFatalError, reportResourceError, reportResourceError, reportResourceError, reset, restoreBaseURI, restoreLanguage, sameBaseURIAsIncludeParent, sameLanguageAsIncludeParent, saveBaseURI, saveLanguage, searchForRecursiveIncludes, setDocumentSource, setDTDHandler, setDTDSource, setFeature, setHref, setParent, setSawFallback, setSawInclude, setState, setupCurrentBaseURI, setXIncludeLocator, startAttlist, startConditional, startDocument, startDTD, startExternalSubset, startGeneralEntity, startParameterEntity, textDecl, unparsedEntityDecl, xmlDecl
-
-
-
-
Field Detail
-
fXPointerParts
protected java.util.ArrayList fXPointerParts
-
fXPointerPart
protected XPointerPart fXPointerPart
-
fFoundMatchingPtrPart
protected boolean fFoundMatchingPtrPart
-
fXPointerErrorReporter
protected XMLErrorReporter fXPointerErrorReporter
-
fErrorHandler
protected org.apache.xerces.xni.parser.XMLErrorHandler fErrorHandler
-
fSymbolTable
protected SymbolTable fSymbolTable
-
fIsXPointerResolved
protected boolean fIsXPointerResolved
-
fFixupBase
protected boolean fFixupBase
-
fFixupLang
protected boolean fFixupLang
-
-
Constructor Detail
-
XPointerHandler
public XPointerHandler()
-
XPointerHandler
public XPointerHandler(SymbolTable symbolTable, org.apache.xerces.xni.parser.XMLErrorHandler errorHandler, XMLErrorReporter errorReporter)
-
-
Method Detail
-
setDocumentHandler
public void setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler handler)
Description copied from interface:org.apache.xerces.xni.parser.XMLDocumentSourceSets the document handler.- Specified by:
setDocumentHandlerin interfaceorg.apache.xerces.xni.parser.XMLDocumentSource- Overrides:
setDocumentHandlerin classXIncludeHandler
-
parseXPointer
public void parseXPointer(java.lang.String xpointer) throws org.apache.xerces.xni.XNIExceptionParses the XPointer framework expression and delegates scheme specific parsing.- Specified by:
parseXPointerin interfaceXPointerProcessor- Parameters:
xpointer- A String representing the xpointer expression.- Throws:
org.apache.xerces.xni.XNIException- Thrown if the xpointer string does not conform to the XPointer Framework syntax or the syntax of the pointer part does not conform to its definition for its scheme.- See Also:
XPointerProcessor.parseXPointer(java.lang.String)
-
resolveXPointer
public boolean resolveXPointer(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs, int event) throws org.apache.xerces.xni.XNIExceptionDescription copied from interface:XPointerProcessorEvaluates an XML resource with respect to an XPointer expressions by checking if it's element and attributes parameters match the criteria specified in the xpointer expression.- Specified by:
resolveXPointerin interfaceXPointerProcessor- Parameters:
element- - The name of the element.attributes- - The element attributes.augs- - Additional information that may include infoset augmentationsevent- - An integer indicating 0 - The start of an element 1 - The end of an element 2 - An empty element call- Returns:
- true if the element was resolved by the xpointer
- Throws:
org.apache.xerces.xni.XNIException- Thrown to signal an error- See Also:
XPointerProcessor.resolveXPointer(org.apache.xerces.xni.QName, org.apache.xerces.xni.XMLAttributes, org.apache.xerces.xni.Augmentations, int event)
-
isFragmentResolved
public boolean isFragmentResolved() throws org.apache.xerces.xni.XNIExceptionReturns true if the Node fragment is resolved.- Specified by:
isFragmentResolvedin interfaceXPointerProcessor- Returns:
- True if the xpointer expression matches a node/fragment in the resource else returns false.
- Throws:
org.apache.xerces.xni.XNIException- Thrown to signal an error- See Also:
XPointerProcessor.isFragmentResolved()
-
isChildFragmentResolved
public boolean isChildFragmentResolved() throws org.apache.xerces.xni.XNIExceptionReturns true if the XPointer expression resolves to a non-element child of the current resource fragment.- Throws:
org.apache.xerces.xni.XNIException- See Also:
XPointerPart.isChildFragmentResolved()
-
isXPointerResolved
public boolean isXPointerResolved() throws org.apache.xerces.xni.XNIExceptionReturns true if the XPointer successfully found a sub-resource .- Specified by:
isXPointerResolvedin interfaceXPointerProcessor- Returns:
- True if the xpointer expression matches a fragment in the resource else returns false.
- Throws:
org.apache.xerces.xni.XNIException- Thrown to signal an error- See Also:
XPointerProcessor.isFragmentResolved()
-
getXPointerPart
public XPointerPart getXPointerPart()
Returns the pointer part used to resolve the document fragment.- Returns:
- String - The pointer part used to resolve the document fragment.
-
initErrorReporter
protected void initErrorReporter()
Initializes error handling objects
-
init
protected void init()
Initializes the XPointer Processor;
-
getPointerParts
public java.util.ArrayList getPointerParts()
Returns an ArrayList of XPointerPart objects- Returns:
- An ArrayList of XPointerPart objects.
-
comment
public void comment(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIExceptionIf the comment is a child of a matched element, then pass else return.- Specified by:
commentin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Specified by:
commentin interfaceorg.apache.xerces.xni.XMLDTDHandler- Overrides:
commentin classXIncludeHandler- Parameters:
text- The text in the comment.augs- Additional information that may include infoset augmentations- Throws:
org.apache.xerces.xni.XNIException- Thrown by application to signal an error.
-
processingInstruction
public void processingInstruction(java.lang.String target, org.apache.xerces.xni.XMLString data, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIExceptionA processing instruction. Processing instructions consist of a target name and, optionally, text data. The data is only meaningful to the application.Typically, a processing instruction's data will contain a series of pseudo-attributes. These pseudo-attributes follow the form of element attributes but are not parsed or presented to the application as anything other than text. The application is responsible for parsing the data.
- Specified by:
processingInstructionin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Specified by:
processingInstructionin interfaceorg.apache.xerces.xni.XMLDTDHandler- Overrides:
processingInstructionin classXIncludeHandler- Parameters:
target- The target.data- The data or null if none specified.augs- Additional information that may include infoset augmentations- Throws:
org.apache.xerces.xni.XNIException- Thrown by handler to signal an error.
-
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.XNIExceptionThe start of an element.- Specified by:
startElementin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
startElementin classXIncludeHandler- Parameters:
element- The name of the element.attributes- The element attributes.augs- Additional information that may include infoset augmentations- Throws:
org.apache.xerces.xni.XNIException- Thrown by handler to signal an error.
-
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.XNIExceptionAn empty element.- Specified by:
emptyElementin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
emptyElementin classXIncludeHandler- Parameters:
element- The name of the element.attributes- The element attributes.augs- Additional information that may include infoset augmentations- Throws:
org.apache.xerces.xni.XNIException- Thrown by handler to signal an error.
-
characters
public void characters(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIExceptionCharacter content.- Specified by:
charactersin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
charactersin classXIncludeHandler- Parameters:
text- The content.augs- Additional information that may include infoset augmentations- Throws:
org.apache.xerces.xni.XNIException- Thrown by handler to signal an error.
-
ignorableWhitespace
public void ignorableWhitespace(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIExceptionIgnorable whitespace. For this method to be called, the document source must have some way of determining that the text containing only whitespace characters should be considered ignorable. For example, the validator can determine if a length of whitespace characters in the document are ignorable based on the element content model.- Specified by:
ignorableWhitespacein interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
ignorableWhitespacein classXIncludeHandler- Parameters:
text- The ignorable whitespace.augs- Additional information that may include infoset augmentations- Throws:
org.apache.xerces.xni.XNIException- Thrown by handler to signal an error.
-
endElement
public void endElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIExceptionThe end of an element.- Specified by:
endElementin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
endElementin classXIncludeHandler- Parameters:
element- The name of the element.augs- Additional information that may include infoset augmentations- Throws:
org.apache.xerces.xni.XNIException- Thrown by handler to signal an error.
-
startCDATA
public void startCDATA(org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIExceptionThe start of a CDATA section.- Specified by:
startCDATAin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
startCDATAin classXIncludeHandler- Parameters:
augs- Additional information that may include infoset augmentations- Throws:
org.apache.xerces.xni.XNIException- Thrown by handler to signal an error.
-
endCDATA
public void endCDATA(org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIExceptionThe end of a CDATA section.- Specified by:
endCDATAin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
endCDATAin classXIncludeHandler- Parameters:
augs- Additional information that may include infoset augmentations- Throws:
org.apache.xerces.xni.XNIException- Thrown by handler to signal an error.
-
setProperty
public void setProperty(java.lang.String propertyId, java.lang.Object value) throws org.apache.xerces.xni.parser.XMLConfigurationExceptionSets 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:
setPropertyin interfaceorg.apache.xerces.xni.parser.XMLComponent- Overrides:
setPropertyin classXIncludeHandler- Parameters:
propertyId- The property identifier.value- The value of the property.- Throws:
org.apache.xerces.xni.parser.XMLConfigurationException- Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.
-
-