org.apache.xerces.xpointer

Class XPointerHandler

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,v 1.1 2005/06/17 22:00:20 nddelima Exp $

Field Summary
protected XMLErrorHandlerfErrorHandler
protected booleanfFixupBase
protected booleanfFixupLang
protected booleanfFoundMatchingPtrPart
protected booleanfIsXPointerResolved
protected SymbolTablefSymbolTable
protected XMLErrorReporterfXPointerErrorReporter
protected XPointerPartfXPointerPart
protected VectorfXPointerParts
Constructor Summary
XPointerHandler()
XPointerHandler(SymbolTable symbolTable, XMLErrorHandler errorHandler, XMLErrorReporter errorReporter)
Method Summary
voidcharacters(XMLString text, Augmentations augs)
Character content.
voidcomment(XMLString text, Augmentations augs)
If the comment is a child of a matched element, then pass else return.
voidemptyElement(QName element, XMLAttributes attributes, Augmentations augs)
An empty element.
voidendCDATA(Augmentations augs)
The end of a CDATA section.
voidendElement(QName element, Augmentations augs)
The end of an element.
VectorgetPointerParts()
Returns a Vector of XPointerPart objects
XPointerPartgetXPointerPart()
Returns the pointer part used to resolve the document fragment.
voidignorableWhitespace(XMLString text, Augmentations augs)
Ignorable whitespace.
protected voidinit()
Initializes the XPointer Processor;
protected voidinitErrorReporter()
Initializes error handling objects
booleanisChildFragmentResolved()
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(String xpointer)
Parses the XPointer framework expression and delegates scheme specific parsing.
voidprocessingInstruction(String target, XMLString data, Augmentations augs)
A processing instruction.
booleanresolveXPointer(QName element, XMLAttributes attributes, Augmentations augs, int event)
voidsetProperty(String propertyId, Object value)

Sets the value of a property.

voidstartCDATA(Augmentations augs)
The start of a CDATA section.
voidstartElement(QName element, XMLAttributes attributes, Augmentations augs)
The start of an element.

Field Detail

fErrorHandler

protected XMLErrorHandler fErrorHandler

fFixupBase

protected boolean fFixupBase

fFixupLang

protected boolean fFixupLang

fFoundMatchingPtrPart

protected boolean fFoundMatchingPtrPart

fIsXPointerResolved

protected boolean fIsXPointerResolved

fSymbolTable

protected SymbolTable fSymbolTable

fXPointerErrorReporter

protected XMLErrorReporter fXPointerErrorReporter

fXPointerPart

protected XPointerPart fXPointerPart

fXPointerParts

protected Vector fXPointerParts

Constructor Detail

XPointerHandler

public XPointerHandler()

XPointerHandler

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

Method Detail

characters

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.

comment

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.

emptyElement

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.

endCDATA

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.

endElement

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.

getPointerParts

public Vector getPointerParts()
Returns a Vector of XPointerPart objects

Returns: A Vector of XPointerPart objects.

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.

ignorableWhitespace

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.

init

protected void init()
Initializes the XPointer Processor;

initErrorReporter

protected void initErrorReporter()
Initializes error handling objects

isChildFragmentResolved

public boolean isChildFragmentResolved()
Returns true if the XPointer expression resolves to a non-element child of the current resource fragment.

See Also:

isFragmentResolved

public boolean isFragmentResolved()
Returns true if the Node fragment is resolved.

See Also: isFragmentResolved

isXPointerResolved

public boolean isXPointerResolved()
Returns true if the XPointer successfully found a sub-resource .

See Also: isFragmentResolved

parseXPointer

public void parseXPointer(String xpointer)
Parses the XPointer framework expression and delegates scheme specific parsing.

See Also: XPointerProcessor

processingInstruction

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.

resolveXPointer

public boolean resolveXPointer(QName element, XMLAttributes attributes, Augmentations augs, int event)

See Also: XPointerProcessor

setProperty

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.

startCDATA

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.

startElement

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.

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