APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xerces.internal.impl.xs.identity

public Class XPathMatcher

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.org.apache.xerces.internal.impl.xs.identity.Field.Matcher, com.sun.org.apache.xerces.internal.impl.xs.identity.Selector.Matcher
Imports
com.sun.org.apache.xerces.internal.impl.Constants, com.sun.org.apache.xerces.internal.impl.xpath.XPath, com.sun.org.apache.xerces.internal.util.IntStack, com.sun.org.apache.xerces.internal.xni.QName, .XMLAttributes, com.sun.org.apache.xerces.internal.xs.AttributePSVI, .ShortList, .XSTypeDefinition, org.xml.sax.SAXException

XPath matcher.
Author
Andy Clark, IBM

Field Summary

Modifier and TypeField and Description
protected static final boolean
DEBUG_ALL

Compile to true to debug everything.

protected static final boolean
DEBUG_ANY

Don't touch this value unless you add more debug constants.

protected static final boolean
DEBUG_MATCH

Compile to true to debug match.

protected static final boolean
DEBUG_METHODS

Compile to true to debug method callbacks.

protected static final boolean
DEBUG_METHODS2

Compile to true to debug important method callbacks.

protected static final boolean
DEBUG_METHODS3

Compile to true to debug the really important methods.

protected static final boolean
DEBUG_STACK

Compile to true to debug step index stack.

private final int[]
fCurrentStep

Current step.

private final XPath.LocationPath[]
fLocationPaths

XPath location path.

private final int[]
fMatched

True if XPath has been matched.

protected Object
fMatchedString

The matching string.

private final int[]
fNoMatchDepth

No match depth.

pack-priv final QName
private final IntStack[]
fStepIndexes

Integer stack of step indexes.

protected static final int
protected static final int
protected static final int
protected static final int

Constructor Summary

AccessConstructor and Description
public
XPathMatcher(XPath
The xpath.
xpath
)

Constructs an XPath matcher that implements a document fragment handler.

Method Summary

Modifier and TypeMethod and Description
public void
endElement(QName
name of the element.
element
,
XSTypeDefinition
content type of this element. IOW, the XML schema type of the value. Note that this may not be the type declared in the element declaration, but it is "the actual type". For example, if the XML is <foo xsi:type="xs:string">aaa</foo>, this parameter will be "xs:string".
type
,
boolean
- nillable true if the element declaration is nillable.
nillable
,
Object
- actual value the typed value of the content of this element.
value
,
short valueType, ShortList itemValueType)

protected void
handleContent(XSTypeDefinition type, boolean nillable, Object value, short valueType, ShortList itemValueType)

public boolean
isMatched()

Returns value of first member of fMatched that is nonzero.

protected void
matched(Object actualValue, short valueType, ShortList itemValueType, boolean isNil)

This method is called when the XPath handler matches the XPath expression.

private static boolean
matches(XPath.NodeTest nodeTest, QName value)

Returns true if the given QName matches the node test.

private String
normalize(String s)

Normalizes text.

public void
startDocumentFragment()

The start of the document fragment.

public void
startElement(QName
The name of the element.
element
,
XMLAttributes
The element attributes.
attributes
)

The start of an element.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of this object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

DEBUG_ALLback to summary
protected static final boolean DEBUG_ALL

Compile to true to debug everything.

DEBUG_ANYback to summary
protected static final boolean DEBUG_ANY

Don't touch this value unless you add more debug constants.

DEBUG_MATCHback to summary
protected static final boolean DEBUG_MATCH

Compile to true to debug match.

DEBUG_METHODSback to summary
protected static final boolean DEBUG_METHODS

Compile to true to debug method callbacks.

DEBUG_METHODS2back to summary
protected static final boolean DEBUG_METHODS2

Compile to true to debug important method callbacks.

DEBUG_METHODS3back to summary
protected static final boolean DEBUG_METHODS3

Compile to true to debug the really important methods.

DEBUG_STACKback to summary
protected static final boolean DEBUG_STACK

Compile to true to debug step index stack.

fCurrentStepback to summary
private final int[] fCurrentStep

Current step.

fLocationPathsback to summary
private final XPath.LocationPath[] fLocationPaths

XPath location path.

fMatchedback to summary
private final int[] fMatched

True if XPath has been matched.

fMatchedStringback to summary
protected Object fMatchedString

The matching string.

fNoMatchDepthback to summary
private final int[] fNoMatchDepth

No match depth. The value of this field will be zero while matching is successful for the given xpath expression.

fQNameback to summary
pack-priv final QName fQName
fStepIndexesback to summary
private final IntStack[] fStepIndexes

Integer stack of step indexes.

MATCHEDback to summary
protected static final int MATCHED
MATCHED_ATTRIBUTEback to summary
protected static final int MATCHED_ATTRIBUTE
MATCHED_DESCENDANTback to summary
protected static final int MATCHED_DESCENDANT
MATCHED_DESCENDANT_PREVIOUSback to summary
protected static final int MATCHED_DESCENDANT_PREVIOUS

Constructor Detail

XPathMatcherback to summary
public XPathMatcher(XPath xpath)

Constructs an XPath matcher that implements a document fragment handler.

Parameters
xpath:XPath

The xpath.

Method Detail

endElementback to summary
public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object value, short valueType, ShortList itemValueType)
Parameters
element:QName

name of the element.

type:XSTypeDefinition

content type of this element. IOW, the XML schema type of the value. Note that this may not be the type declared in the element declaration, but it is "the actual type". For example, if the XML is <foo xsi:type="xs:string">aaa</foo>, this parameter will be "xs:string".

nillable:boolean

- nillable true if the element declaration is nillable.

value:Object

- actual value the typed value of the content of this element.

handleContentback to summary
protected void handleContent(XSTypeDefinition type, boolean nillable, Object value, short valueType, ShortList itemValueType)
isMatchedback to summary
public boolean isMatched()

Returns value of first member of fMatched that is nonzero.

matchedback to summary
protected void matched(Object actualValue, short valueType, ShortList itemValueType, boolean isNil)

This method is called when the XPath handler matches the XPath expression. Subclasses can override this method to provide default handling upon a match.

matchesback to summary
private static boolean matches(XPath.NodeTest nodeTest, QName value)

Returns true if the given QName matches the node test.

normalizeback to summary
private String normalize(String s)

Normalizes text.

startDocumentFragmentback to summary
public void startDocumentFragment()

The start of the document fragment.

startElementback to summary
public void startElement(QName element, XMLAttributes attributes)

The start of an element. If the document specifies the start element by using an empty tag, then the startElement method will immediately be followed by the endElement method, with no intervening methods.

Parameters
element:QName

The name of the element.

attributes:XMLAttributes

The element attributes.

Exceptions
SAXException:
Thrown by handler to signal an error.
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this object.