XmlExpectationsHelper (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.test.util

## Class XmlExpectationsHelper

- java.lang.Object
- - org.springframework.test.util.XmlExpectationsHelper

-     public class XmlExpectationsHelper
      extends Object

  A helper class for assertions on XML content.
  Since:
    3.2
  Author:
    Rossen Stoyanchev

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XmlExpectationsHelper()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `assertNode(String content, org.hamcrest.Matcher<? super Node> matcher)` Parse the content as `Node` and apply a `Matcher`.
    `void` | `assertSource(String content, org.hamcrest.Matcher<? super Source> matcher)` Parse the content as `DOMSource` and apply a `Matcher`.
    `void` | `assertXmlEqual(String expected, String actual)` Parse the expected and actual content strings as XML and assert that the two are "similar" -- i.e.

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

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

- - ### Constructor Detail

    - #### XmlExpectationsHelper

          public XmlExpectationsHelper()

  - ### Method Detail

    - #### assertNode

          public void assertNode(String content,
                        org.hamcrest.Matcher<? super Node> matcher)
                          throws Exception

      Parse the content as `Node` and apply a `Matcher`.
      Throws:
        `Exception`

    - #### assertSource

          public void assertSource(String content,
                          org.hamcrest.Matcher<? super Source> matcher)
                            throws Exception

      Parse the content as `DOMSource` and apply a `Matcher`.
      Throws:
        `Exception`
      See Also:
        xml-matchers

    - #### assertXmlEqual

          public void assertXmlEqual(String expected,
                            String actual)
                              throws Exception

      Parse the expected and actual content strings as XML and assert that the two are "similar" -- i.e. they contain the same elements and attributes regardless of order.

      Use of this method assumes the XMLUnit library is available.

      Parameters:
        `expected` - the expected XML content
        `actual` - the actual XML content
      Throws:
        `Exception`
      See Also:
        `MockMvcResultMatchers.xpath(String, Object...)`, `MockMvcResultMatchers.xpath(String, Map, Object...)`