DocumentComparator (JiBX Java data binding to XML - Version 1.2.6)
Date: 2014-12-30

org.jibx.extras

## Class DocumentComparator

- java.lang.Object
- - org.jibx.extras.DocumentComparator

-     public class DocumentComparator
      extends java.lang.Object

  XML document comparator. This uses XMLPull parsers to read a pair of documents in parallel, comparing the streams of components seen from the two documents. The comparison ignores differences in whitespace separating elements, but in non-schema mode treats whitespace as significant within elements with only character data content.
  Author:
    Dennis M. Sosnoski

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DocumentComparator(java.io.PrintStream print)` Constructor.
    `DocumentComparator(java.io.PrintStream print, boolean schema)` Constructor with schema adjustments flag specified.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `compare(java.io.Reader rdra, java.io.Reader rdrb)` Compares a pair of documents by reading them in parallel from a pair of parsers.

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

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

- - ### Constructor Detail

    - #### DocumentComparator

          public DocumentComparator(java.io.PrintStream print,
                            boolean schema)
                             throws org.xmlpull.v1.XmlPullParserException

      Constructor with schema adjustments flag specified. Builds the actual parsers and sets up for comparisons.
      Parameters:
        `print` - print stream for reporting differences
        `schema` - use schema adjustments in comparisons flag
      Throws:
        `org.xmlpull.v1.XmlPullParserException` - on error creating parsers

    - #### DocumentComparator

          public DocumentComparator(java.io.PrintStream print)
                             throws org.xmlpull.v1.XmlPullParserException

      Constructor. Builds the actual parser.
      Parameters:
        `print` - print stream for reporting differences
      Throws:
        `org.xmlpull.v1.XmlPullParserException` - on error creating parsers

  - ### Method Detail

    - #### compare

          public boolean compare(java.io.Reader rdra,
                        java.io.Reader rdrb)

      Compares a pair of documents by reading them in parallel from a pair of parsers. The comparison ignores differences in whitespace separating elements, but treats whitespace as significant within elements with only character data content.
      Parameters:
        `rdra` - reader for first document to be compared
        `rdrb` - reader for second document to be compared
      Returns:
        `true` if the documents are the same, `false` if they're different

Project Web Site |