org.apache.xerces.impl.xs.identity

## Class XPathMatcher

- java.lang.Object
- - org.apache.xerces.impl.xs.identity.XPathMatcher

- Direct Known Subclasses:
    Field.Matcher, Selector.Matcher

      public class XPathMatcher
      extends java.lang.Object

  XPath matcher.
  Version:
    $Id: XPathMatcher.java 1136825 2011-06-17 09:37:42Z mukulg $
  Author:
    Andy Clark, IBM

  # INTERNAL:

    Usage of this class is not supported. It may be altered or removed at any time.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static boolean` | `DEBUG_ALL` Compile to true to debug everything.
    `protected static boolean` | `DEBUG_ANY` Don't touch this value unless you add more debug constants.
    `protected static boolean` | `DEBUG_MATCH` Compile to true to debug match.
    `protected static boolean` | `DEBUG_METHODS` Compile to true to debug method callbacks.
    `protected static boolean` | `DEBUG_METHODS2` Compile to true to debug important method callbacks.
    `protected static boolean` | `DEBUG_METHODS3` Compile to true to debug the really important methods.
    `protected static boolean` | `DEBUG_STACK` Compile to true to debug step index stack.
    `protected java.lang.Object` | `fMatchedString` The matching string.
    `protected java.lang.String` | `fXpathDefaultNamespace` XPath default namespace.
    `protected static int` | `MATCHED`
    `protected static int` | `MATCHED_ATTRIBUTE`
    `protected static int` | `MATCHED_DESCENDANT`
    `protected static int` | `MATCHED_DESCENDANT_PREVIOUS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XPathMatcher(XPath xpath)` Constructs an XPath matcher that implements a document fragment handler.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `endElement(org.apache.xerces.xni.QName element, org.apache.xerces.xs.XSTypeDefinition type, boolean nillable, java.lang.Object value, short valueType, org.apache.xerces.xs.ShortList itemValueType)`
    `protected void` | `handleContent(org.apache.xerces.xs.XSTypeDefinition type, boolean nillable, java.lang.Object value, short valueType, org.apache.xerces.xs.ShortList itemValueType)`
    `boolean` | `isMatched()` Returns value of first member of fMatched that is nonzero.
    `protected void` | `matched(java.lang.Object actualValue, short valueType, org.apache.xerces.xs.ShortList itemValueType, boolean isNil)` This method is called when the XPath handler matches the XPath expression.
    `void` | `setXPathDefaultNamespace(java.lang.String xpathDefaultNamespace)`
    `void` | `startDocumentFragment()` The start of the document fragment.
    `void` | `startElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes)` The start of an element.
    `java.lang.String` | `toString()` Returns a string representation of this object.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEBUG_ALL

          protected static final boolean DEBUG_ALL

      Compile to true to debug everything.
      See Also:
        Constant Field Values

    - #### DEBUG_METHODS

          protected static final boolean DEBUG_METHODS

      Compile to true to debug method callbacks.
      See Also:
        Constant Field Values

    - #### DEBUG_METHODS2

          protected static final boolean DEBUG_METHODS2

      Compile to true to debug important method callbacks.
      See Also:
        Constant Field Values

    - #### DEBUG_METHODS3

          protected static final boolean DEBUG_METHODS3

      Compile to true to debug the really important methods.
      See Also:
        Constant Field Values

    - #### DEBUG_MATCH

          protected static final boolean DEBUG_MATCH

      Compile to true to debug match.
      See Also:
        Constant Field Values

    - #### DEBUG_STACK

          protected static final boolean DEBUG_STACK

      Compile to true to debug step index stack.
      See Also:
        Constant Field Values

    - #### DEBUG_ANY

          protected static final boolean DEBUG_ANY

      Don't touch this value unless you add more debug constants.
      See Also:
        Constant Field Values

    - #### MATCHED

          protected static final int MATCHED

      See Also:
        Constant Field Values

    - #### MATCHED_ATTRIBUTE

          protected static final int MATCHED_ATTRIBUTE

      See Also:
        Constant Field Values

    - #### MATCHED_DESCENDANT

          protected static final int MATCHED_DESCENDANT

      See Also:
        Constant Field Values

    - #### MATCHED_DESCENDANT_PREVIOUS

          protected static final int MATCHED_DESCENDANT_PREVIOUS

      See Also:
        Constant Field Values

    - #### fMatchedString

          protected java.lang.Object fMatchedString

      The matching string.

    - #### fXpathDefaultNamespace

          protected java.lang.String fXpathDefaultNamespace

      XPath default namespace.

  - ### Constructor Detail

    - #### XPathMatcher

          public XPathMatcher(XPath xpath)

      Constructs an XPath matcher that implements a document fragment handler.
      Parameters:
        `xpath` - The xpath.

  - ### Method Detail

    - #### isMatched

          public boolean isMatched()

      Returns value of first member of fMatched that is nonzero.

    - #### handleContent

          protected void handleContent(org.apache.xerces.xs.XSTypeDefinition type,
                           boolean nillable,
                           java.lang.Object value,
                           short valueType,
                           org.apache.xerces.xs.ShortList itemValueType)

    - #### matched

          protected void matched(java.lang.Object actualValue,
                     short valueType,
                     org.apache.xerces.xs.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.

    - #### startDocumentFragment

          public void startDocumentFragment()

      The start of the document fragment.

    - #### startElement

          public void startElement(org.apache.xerces.xni.QName element,
                          org.apache.xerces.xni.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` - The name of the element.
        `attributes` - The element attributes.
      Throws:
        `org.xml.sax.SAXException` - Thrown by handler to signal an error.

    - #### endElement

          public void endElement(org.apache.xerces.xni.QName element,
                        org.apache.xerces.xs.XSTypeDefinition type,
                        boolean nillable,
                        java.lang.Object value,
                        short valueType,
                        org.apache.xerces.xs.ShortList itemValueType)

      Parameters:
        `element` - name of the element.
        `type` - 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` - - nillable true if the element declaration is nillable.
        `value` - - actual value the typed value of the content of this element.

    - #### toString

          public java.lang.String toString()

      Returns a string representation of this object.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### setXPathDefaultNamespace

          public void setXPathDefaultNamespace(java.lang.String xpathDefaultNamespace)

Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.