Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weblogic.apache.xpath.patterns
Class NodeTest

    java.lang.Object
      |
      +--weblogic.apache.xpath.Expression
            |
            +--weblogic.apache.xpath.patterns.NodeTest

Direct Known Subclasses:
  PredicatedNodeTest, StepPattern

public class NodeTest
extends Expression

This is the basic node test class for both match patterns and location path steps.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

See Also:
  Serialized Form

Field Summary
`protected java.lang.String` | `m_name` The local name to be tested for.
`protected int` | `m_whatToShow` This attribute determines which node types are accepted.
`static XNumber` | `SCORE_NODETEST` The match score if the pattern consists of just a NodeTest.
`static XNumber` | `SCORE_NONE` The match score if no match is made.
`static XNumber` | `SCORE_NSWILD` The match score if the pattern pattern has the form NCName:*.
`static XNumber` | `SCORE_OTHER` The match score if the pattern consists of something other than just a NodeTest or just a qname.
`static XNumber` | `SCORE_QNAME` The match score if the pattern has the form of a QName optionally preceded by an @ character.
`static int` | `SHOW_BYFUNCTION` Special bitmap for match patterns starting with a function.
`static java.lang.String` | `SUPPORTS_PRE_STRIPPING` The URL to pass to the Node#supports method, to see if the DOM has already been stripped of whitespace nodes.
`static java.lang.String` | `WILD` The namespace or local name for node tests with a wildcard.

Fields inherited from class weblogic.apache.xpath.Expression
`m_slocator`

Constructor Summary
`NodeTest()` Null argument constructor.
`NodeTest(int whatToShow)` Construct an NodeTest that doesn't test for node names.
`NodeTest(int whatToShow, java.lang.String namespace, java.lang.String name)` Construct an NodeTest that tests for namespaces and node names.

Method Summary
`protected void` | `calcScore()` Static calc of match score.
`static void` | `debugWhatToShow(int whatToShow)` Do a diagnostics dump of a whatToShow bit set.
`XObject` | `execute(XPathContext xctxt)` Test the current node to see if it matches the given node test.
`XObject` | `execute(XPathContext xctxt, int context)` Tell what the test score is for the given node.
`XObject` | `execute(XPathContext xctxt, int context, weblogic.apache.xml.dtm.DTM dtm, int expType)` Tell what the test score is for the given node.
`void` | `fixupVariables(java.util.Vector vars, int globalsSize)` Node tests by themselves do not need to fix up variables.
`double` | `getDefaultScore()` Get the score that this test will return if a test succeeds.
`java.lang.String` | `getLocalName()` Return the local name to be tested.
`java.lang.String` | `getNamespace()` Return the namespace to be tested.
`static int` | `getNodeTypeTest(int whatToShow)` Tell what node type to test, if not DTMFilter.SHOW_ALL.
`XNumber` | `getStaticScore()` Get the static score for this node test.
`int` | `getWhatToShow()` This attribute determines which node types are accepted.
`void` | `initNodeTest(int whatToShow)` Initialize this node test by setting the whatToShow property, and calculating the score that this test will return if a test succeeds.
`void` | `initNodeTest(int whatToShow, java.lang.String namespace, java.lang.String name)` Initialize this node test by setting the whatToShow property and the namespace and local name, and calculating the score that this test will return if a test succeeds.
`void` | `setLocalName(java.lang.String name)` Set the local name to be tested.
`void` | `setNamespace(java.lang.String ns)` Set the namespace to be tested.
`void` | `setStaticScore(XNumber score)` Set the static score for this node test.
`void` | `setWhatToShow(int what)` This attribute determines which node types are accepted.

Methods inherited from class weblogic.apache.xpath.Expression
`asIterator, asNode, assertion, bool, canTraverseOutsideSubtree, error, executeCharsToContentHandler, isNodesetExpr, isStableNumber, num, setSourceLocator, warn, xstr`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### WILD

    public static final java.lang.String WILD

  The namespace or local name for node tests with a wildcard.
  See Also:
    the XPath NameTest production.

### SUPPORTS_PRE_STRIPPING

    public static final java.lang.String SUPPORTS_PRE_STRIPPING

  The URL to pass to the Node#supports method, to see if the DOM has already been stripped of whitespace nodes.

### m_whatToShow

    protected int m_whatToShow

  This attribute determines which node types are accepted.

### SHOW_BYFUNCTION

    public static final int SHOW_BYFUNCTION

  Special bitmap for match patterns starting with a function. Make sure this does not conflict with `NodeFilter`.

### m_name

    protected java.lang.String m_name

  The local name to be tested for.

### SCORE_NODETEST

    public static final XNumber SCORE_NODETEST

  The match score if the pattern consists of just a NodeTest.
  See Also:
    XSLT Specification - 5.5 Conflict Resolution for Template Rules

### SCORE_NSWILD

    public static final XNumber SCORE_NSWILD

  The match score if the pattern pattern has the form NCName:*.
  See Also:
    XSLT Specification - 5.5 Conflict Resolution for Template Rules

### SCORE_QNAME

    public static final XNumber SCORE_QNAME

  The match score if the pattern has the form of a QName optionally preceded by an @ character.
  See Also:
    XSLT Specification - 5.5 Conflict Resolution for Template Rules

### SCORE_OTHER

    public static final XNumber SCORE_OTHER

  The match score if the pattern consists of something other than just a NodeTest or just a qname.
  See Also:
    XSLT Specification - 5.5 Conflict Resolution for Template Rules

### SCORE_NONE

    public static final XNumber SCORE_NONE

  The match score if no match is made.
  See Also:
    XSLT Specification - 5.5 Conflict Resolution for Template Rules

Constructor Detail

### NodeTest

    public NodeTest(int whatToShow,
                    java.lang.String namespace,
                    java.lang.String name)

  Construct an NodeTest that tests for namespaces and node names.

  Parameters:
    `whatToShow` - Bit set defined mainly by `NodeFilter`.
    `namespace` - The namespace to be tested.
    `name` - The local name to be tested.

### NodeTest

    public NodeTest(int whatToShow)

  Construct an NodeTest that doesn't test for node names.

  Parameters:
    `whatToShow` - Bit set defined mainly by `NodeFilter`.

### NodeTest

    public NodeTest()

  Null argument constructor.

Method Detail

### getWhatToShow

    public int getWhatToShow()

  This attribute determines which node types are accepted. These constants are defined in the `NodeFilter` interface.

  Returns:
    bitset mainly defined in `NodeFilter`.

### setWhatToShow

    public void setWhatToShow(int what)

  This attribute determines which node types are accepted. These constants are defined in the `NodeFilter` interface.

  Parameters:
    `what` - bitset mainly defined in `NodeFilter`.

### getNamespace

    public java.lang.String getNamespace()

  Return the namespace to be tested.

  Returns:
    The namespace to be tested for, or `WILD`, or null.

### setNamespace

    public void setNamespace(java.lang.String ns)

  Set the namespace to be tested.

  Parameters:
    `ns` - The namespace to be tested for, or `WILD`, or null.

### getLocalName

    public java.lang.String getLocalName()

  Return the local name to be tested.

  Returns:
    the local name to be tested, or `WILD`, or an empty string.

### setLocalName

    public void setLocalName(java.lang.String name)

  Set the local name to be tested.

  Parameters:
    `name` - the local name to be tested, or `WILD`, or an empty string.

### initNodeTest

    public void initNodeTest(int whatToShow)

  Initialize this node test by setting the whatToShow property, and calculating the score that this test will return if a test succeeds.

  Parameters:
    `whatToShow` - Bit set defined mainly by `NodeFilter`.

### initNodeTest

    public void initNodeTest(int whatToShow,
                             java.lang.String namespace,
                             java.lang.String name)

  Initialize this node test by setting the whatToShow property and the namespace and local name, and calculating the score that this test will return if a test succeeds.

  Parameters:
    `whatToShow` - Bit set defined mainly by `NodeFilter`.
    `namespace` - The namespace to be tested.
    `name` - The local name to be tested.

### getStaticScore

    public XNumber getStaticScore()

  Get the static score for this node test.

  Returns:
    Should be one of the SCORE_XXX constants.

### setStaticScore

    public void setStaticScore(XNumber score)

  Set the static score for this node test.

  Parameters:
    `score` - Should be one of the SCORE_XXX constants.

### calcScore

    protected void calcScore()

  Static calc of match score.

### getDefaultScore

    public double getDefaultScore()

  Get the score that this test will return if a test succeeds.

  Returns:
    the score that this test will return if a test succeeds.

### getNodeTypeTest

    public static int getNodeTypeTest(int whatToShow)

  Tell what node type to test, if not DTMFilter.SHOW_ALL.

  Parameters:
    `whatToShow` - Bit set defined mainly by `DTMFilter`.
  Returns:
    the node type for the whatToShow. Since whatToShow can specify multiple types, it will return the first bit tested that is on, so the caller of this function should take care that this is the function they really want to call. If none of the known bits are set, this function will return zero.

### debugWhatToShow

    public static void debugWhatToShow(int whatToShow)

  Do a diagnostics dump of a whatToShow bit set.

  Parameters:
    `whatToShow` - Bit set defined mainly by `DTMFilter`.

### execute

    public XObject execute(XPathContext xctxt,
                           int context)
                    throws javax.xml.transform.TransformerException

  Tell what the test score is for the given node.

  Parameters:
    `xctxt` - XPath runtime context.
    `context` - The node being tested.
  Returns:
    `SCORE_NODETEST`, `SCORE_NONE`, `SCORE_NSWILD`, `SCORE_QNAME`, or `SCORE_OTHER`.
  Throws:
    javax.xml.transform.TransformerException -
  Overrides:
    execute in class Expression

### execute

    public XObject execute(XPathContext xctxt,
                           int context,
                           weblogic.apache.xml.dtm.DTM dtm,
                           int expType)
                    throws javax.xml.transform.TransformerException

  Tell what the test score is for the given node.

  Parameters:
    `xctxt` - XPath runtime context.
    `context` - The node being tested.
  Returns:
    `SCORE_NODETEST`, `SCORE_NONE`, `SCORE_NSWILD`, `SCORE_QNAME`, or `SCORE_OTHER`.
  Throws:
    javax.xml.transform.TransformerException -
  Overrides:
    execute in class Expression

### execute

    public XObject execute(XPathContext xctxt)
                    throws javax.xml.transform.TransformerException

  Test the current node to see if it matches the given node test.

  Parameters:
    `xctxt` - XPath runtime context.
  Returns:
    `SCORE_NODETEST`, `SCORE_NONE`, `SCORE_NSWILD`, `SCORE_QNAME`, or `SCORE_OTHER`.
  Throws:
    javax.xml.transform.TransformerException -
  Overrides:
    execute in class Expression

### fixupVariables

    public void fixupVariables(java.util.Vector vars,
                               int globalsSize)

  Node tests by themselves do not need to fix up variables.

  Overrides:
    fixupVariables in class Expression

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs70
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference