Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hamcrest.xml
Class HasXPath

    java.lang.Object
      org.hamcrest.BaseMatcher<T>
          org.hamcrest.TypeSafeMatcher<Node>
              org.hamcrest.xml.HasXPath

All Implemented Interfaces:
  Matcher<Node>, SelfDescribing

    public class HasXPath

extends TypeSafeMatcher<Node>

Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.

Author:
  Joe Walnes

Constructor Summary
`HasXPath(String xPathExpression, Matcher<String> valueMatcher)`

Method Summary
`void` | `describeTo(Description description)` Generates a description of the object.
`static Matcher<Node>` | `hasXPath(String xPath)`
`static Matcher<Node>` | `hasXPath(String xPath, Matcher<String> valueMatcher)`
`boolean` | `matchesSafely(Node item)` Subclasses should implement this.

Methods inherited from class org.hamcrest.TypeSafeMatcher
`matches`

Methods inherited from class org.hamcrest.BaseMatcher
`_dont_implement_Matcher___instead_extend_BaseMatcher_, toString`

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

Constructor Detail

### HasXPath

    public HasXPath(String xPathExpression,
                    Matcher<String> valueMatcher)

Parameters:
  `xPathExpression` - XPath expression.
  `valueMatcher` - Matcher to use at given XPath. May be null to specify that the XPath must exist but the value is irrelevant.

Method Detail

### matchesSafely

    public boolean matchesSafely(Node item)

  Description copied from class: `TypeSafeMatcher`
  Subclasses should implement this. The item will already have been checked for the specific type and will never be null.

  Specified by:
    `matchesSafely` in class `TypeSafeMatcher<Node>`

### describeTo

    public void describeTo(Description description)

  Description copied from interface: `SelfDescribing`
  Generates a description of the object. The description may be part of a a description of a larger object of which this is just a component, so it should be worded appropriately.

  Parameters:
    `description` - The description to be built or appended to.

### hasXPath

    public static Matcher<Node> hasXPath(String xPath,
                                         Matcher<String> valueMatcher)

### hasXPath

    public static Matcher<Node> hasXPath(String xPath)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD