public class DocumentComparator extends Object
| Modifier and Type | Field and Description |
|---|---|
protected PrintStream |
m_differencePrint
Print stream for reporting differences.
|
protected org.xmlpull.v1.XmlPullParser |
m_parserA
Parser for first document.
|
protected org.xmlpull.v1.XmlPullParser |
m_parserB
Parser for second document.
|
protected boolean |
m_schemaCompare
Compare using schema data value adjustments flag.
|
| Constructor and Description |
|---|
DocumentComparator(PrintStream print)
Constructor.
|
DocumentComparator(PrintStream print,
boolean schema)
Constructor with schema adjustments flag specified.
|
| Modifier and Type | Method and Description |
|---|---|
protected static String |
buildName(String ns,
String name)
Build name string.
|
protected static String |
buildPositionString(org.xmlpull.v1.XmlPullParser parser)
Build parse input position description.
|
boolean |
compare(Reader rdra,
Reader rdrb)
Compares a pair of documents by reading them in parallel from a pair of
parsers.
|
protected boolean |
equalValues(String texta,
String textb)
Check for equal values.
|
protected boolean |
matchAttributes()
Verifies that the attributes on the current start tags match.
|
protected boolean |
matchNames()
Verifies that the current start or end tag names match.
|
protected boolean |
matchText(String texta,
String textb,
String lead)
Check if two text strings match, ignoring leading and trailing spaces.
|
protected void |
printError(String msg)
Prints error description text.
|
protected org.xmlpull.v1.XmlPullParser m_parserA
protected org.xmlpull.v1.XmlPullParser m_parserB
protected PrintStream m_differencePrint
protected boolean m_schemaCompare
public DocumentComparator(PrintStream print, boolean schema) throws org.xmlpull.v1.XmlPullParserException
print - print stream for reporting differencesschema - use schema adjustments in comparisons flagorg.xmlpull.v1.XmlPullParserException - on error creating parserspublic DocumentComparator(PrintStream print) throws org.xmlpull.v1.XmlPullParserException
print - print stream for reporting differencesorg.xmlpull.v1.XmlPullParserException - on error creating parsersprotected static String buildPositionString(org.xmlpull.v1.XmlPullParser parser)
parser - for which to build descriptionprotected static String buildName(String ns, String name)
ns - namespace URIname - local nameprotected void printError(String msg)
msg - error message textprotected boolean equalValues(String texta, String textb)
texta - textb - true if values match, false if notprotected boolean matchAttributes()
true if the attributes match, false if
notprotected boolean matchText(String texta, String textb, String lead)
texta - textb - lead - error text leadtrue if the texts match, false if
notprotected boolean matchNames()
true if the names match, false if notpublic boolean compare(Reader rdra, Reader rdrb)
rdra - reader for first document to be comparedrdrb - reader for second document to be comparedtrue if the documents are the same,
false if they're differentCopyright © 2005-2014 jibx.org. All Rights Reserved.