## 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 treats whitespace as significant within elements with only character data content.

Author:
  Dennis M. Sosnoski

Constructor Summary
`DocumentComparator(java.io.PrintStream print)` Constructor.

Method Summary
`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)
                       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 |