| java.lang.Object org.jibx.extras.DocumentComparator
DocumentComparator | public class DocumentComparator (Code) | | 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 |
m_differencePrint | protected PrintStream m_differencePrint(Code) | | Print stream for reporting differences.
|
m_parserA | protected XmlPullParser m_parserA(Code) | | Parser for first document.
|
m_parserB | protected XmlPullParser m_parserB(Code) | | Parser for second document.
|
DocumentComparator | public DocumentComparator(PrintStream print) throws XmlPullParserException(Code) | | Constructor. Builds the actual parser.
Parameters: print - print stream for reporting differences throws: XmlPullParserException - on error creating parsers |
buildName | protected String buildName(String ns, String name)(Code) | | Build name string.
Parameters: ns - namespace URI Parameters: name - local name printable names string |
buildPositionString | protected String buildPositionString(XmlPullParser parser)(Code) | | Build parse input position description.
Parameters: parser - for which to build description text description of current parse position |
compare | public boolean compare(Reader rdra, Reader rdrb)(Code) | | 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 Parameters: rdrb - reader for second document to be compared true if the documents are the same,false if they're different |
matchAttributes | protected boolean matchAttributes()(Code) | | Verifies that the attributes on the current start tags match. Any
mismatches are printed immediately.
true if the attributes match, false ifnot |
matchNames | protected boolean matchNames()(Code) | | Verifies that the current start or end tag names match.
true if the names match, false if not |
matchText | protected boolean matchText(String texta, String textb, String lead)(Code) | | Check if two text strings match, ignoring leading and trailing spaces.
Any mismatch is printed immediately, with the supplied lead text.
Parameters: texta - Parameters: textb - Parameters: lead - error text lead true if the texts match, false ifnot |
printError | protected void printError(String msg)(Code) | | Prints error description text. The generated text include position
information from both documents.
Parameters: msg - error message text |
|
|