public final class

XPointerHandler

extends XIncludeHandler
implements XPointerProcessor
java.lang.Object
   ↳ org.apache.xerces.xinclude.XIncludeHandler
     ↳ org.apache.xerces.xpointer.XPointerHandler

Class Overview

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.

@xerces.internal

Summary

[Expand]
Inherited Constants
From class org.apache.xerces.xinclude.XIncludeHandler
From interface org.apache.xerces.xni.XMLDTDHandler
From interface org.apache.xerces.xpointer.XPointerProcessor
Fields
protected XMLErrorHandler fErrorHandler
protected boolean fFixupBase
protected boolean fFixupLang
protected boolean fFoundMatchingPtrPart
protected boolean fIsXPointerResolved
protected SymbolTable fSymbolTable
protected XMLErrorReporter fXPointerErrorReporter
protected XPointerPart fXPointerPart
protected Vector fXPointerParts
[Expand]
Inherited Fields
From class org.apache.xerces.xinclude.XIncludeHandler
Public Constructors
XPointerHandler()
XPointerHandler(SymbolTable symbolTable, XMLErrorHandler errorHandler, XMLErrorReporter errorReporter)
Public Methods
void characters(XMLString text, Augmentations augs)
Character content.
void comment(XMLString text, Augmentations augs)
If the comment is a child of a matched element, then pass else return.
void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
An empty element.
void endCDATA(Augmentations augs)
The end of a CDATA section.
void endElement(QName element, Augmentations augs)
The end of an element.
Vector getPointerParts()
Returns a Vector of XPointerPart objects
XPointerPart getXPointerPart()
Returns the pointer part used to resolve the document fragment.
void ignorableWhitespace(XMLString text, Augmentations augs)
Ignorable whitespace.
boolean isChildFragmentResolved()
Returns true if the XPointer expression resolves to a non-element child of the current resource fragment.
boolean isFragmentResolved()
Returns true if the Node fragment is resolved.
boolean isXPointerResolved()
Returns true if the XPointer successfully found a sub-resource .
void parseXPointer(String xpointer)
Parses the XPointer framework expression and delegates scheme specific parsing.
void processingInstruction(String target, XMLString data, Augmentations augs)
A processing instruction.
boolean resolveXPointer(QName element, XMLAttributes attributes, 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.
void setDocumentHandler(XMLDocumentHandler handler)
Sets the document handler.
void setProperty(String propertyId, Object value)

Sets the value of a property.

void startCDATA(Augmentations augs)
The start of a CDATA section.
void startElement(QName element, XMLAttributes attributes, Augmentations augs)
The start of an element.
Protected Methods
void init()
Initializes the XPointer Processor;
void initErrorReporter()
Initializes error handling objects
[Expand]
Inherited Methods
From class org.apache.xerces.xinclude.XIncludeHandler
From class java.lang.Object
From interface org.apache.xerces.xni.XMLDTDHandler
From interface org.apache.xerces.xni.XMLDocumentHandler
From interface org.apache.xerces.xni.parser.XMLComponent
From interface org.apache.xerces.xni.parser.XMLDTDSource
From interface org.apache.xerces.xni.parser.XMLDocumentSource
From interface org.apache.xerces.xpointer.XPointerProcessor

Fields

protected XMLErrorHandler fErrorHandler

protected boolean fFixupBase

protected boolean fFixupLang

protected boolean fFoundMatchingPtrPart

protected boolean fIsXPointerResolved

protected SymbolTable fSymbolTable

protected XMLErrorReporter fXPointerErrorReporter

protected XPointerPart fXPointerPart

protected Vector fXPointerParts

Public Constructors

public XPointerHandler ()

public XPointerHandler (SymbolTable symbolTable, XMLErrorHandler errorHandler, XMLErrorReporter errorReporter)

Public Methods

public void characters (XMLString text, Augmentations augs)

Character content.

Parameters
text The content.
augs Additional information that may include infoset augmentations
Throws
XNIException Thrown by handler to signal an error.

public void comment (XMLString text, Augmentations augs)

If the comment is a child of a matched element, then pass else return.

Parameters
text The text in the comment.
augs Additional information that may include infoset augmentations
Throws
XNIException Thrown by application to signal an error.

public void emptyElement (QName element, XMLAttributes attributes, Augmentations augs)

An empty element.

Parameters
element The name of the element.
attributes The element attributes.
augs Additional information that may include infoset augmentations
Throws
XNIException Thrown by handler to signal an error.

public void endCDATA (Augmentations augs)

The end of a CDATA section.

Parameters
augs Additional information that may include infoset augmentations
Throws
XNIException Thrown by handler to signal an error.

public void endElement (QName element, Augmentations augs)

The end of an element.

Parameters
element The name of the element.
augs Additional information that may include infoset augmentations
Throws
XNIException Thrown by handler to signal an error.

public Vector getPointerParts ()

Returns a Vector of XPointerPart objects

Returns
  • A Vector of XPointerPart objects.

public XPointerPart getXPointerPart ()

Returns the pointer part used to resolve the document fragment.

Returns
  • String - The pointer part used to resolve the document fragment.

public void ignorableWhitespace (XMLString text, Augmentations augs)

Ignorable 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.

Parameters
text The ignorable whitespace.
augs Additional information that may include infoset augmentations
Throws
XNIException Thrown by handler to signal an error.

public boolean isChildFragmentResolved ()

Returns true if the XPointer expression resolves to a non-element child of the current resource fragment.

Throws
XNIException

public boolean isFragmentResolved ()

Returns true if the Node fragment is resolved.

Returns
  • True if the xpointer expression matches a node/fragment in the resource else returns false.
Throws
XNIException

public boolean isXPointerResolved ()

Returns true if the XPointer successfully found a sub-resource .

Returns
  • True if the xpointer expression matches a fragment in the resource else returns false.
Throws
XNIException

public void parseXPointer (String xpointer)

Parses the XPointer framework expression and delegates scheme specific parsing.

Parameters
xpointer A String representing the xpointer expression.
Throws
XNIException

public void processingInstruction (String target, XMLString data, Augmentations augs)

A 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.

Parameters
target The target.
data The data or null if none specified.
augs Additional information that may include infoset augmentations
Throws
XNIException Thrown by handler to signal an error.

public boolean resolveXPointer (QName element, XMLAttributes attributes, 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.

Parameters
element - The name of the element.
attributes - The element attributes.
augs - Additional information that may include infoset augmentations
event - 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
XNIException

public void setDocumentHandler (XMLDocumentHandler handler)

Sets the document handler.

public void setProperty (String propertyId, Object value)

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.

Parameters
propertyId The property identifier.
value The value of the property.
Throws
XMLConfigurationException Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

public void startCDATA (Augmentations augs)

The start of a CDATA section.

Parameters
augs Additional information that may include infoset augmentations
Throws
XNIException Thrown by handler to signal an error.

public void startElement (QName element, XMLAttributes attributes, Augmentations augs)

The start of an element.

Parameters
element The name of the element.
attributes The element attributes.
augs Additional information that may include infoset augmentations
Throws
XNIException Thrown by handler to signal an error.

Protected Methods

protected void init ()

Initializes the XPointer Processor;

protected void initErrorReporter ()

Initializes error handling objects