|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jibx.extras.DocumentComparator
public class DocumentComparator
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.
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
DocumentComparator(PrintStream print)
Constructor. |
|
DocumentComparator(PrintStream print,
boolean schema)
Constructor with schema adjustments flag specified. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.xmlpull.v1.XmlPullParser m_parserA
protected org.xmlpull.v1.XmlPullParser m_parserB
protected PrintStream m_differencePrint
protected boolean m_schemaCompare
| Constructor Detail |
|---|
public DocumentComparator(PrintStream print,
boolean schema)
throws org.xmlpull.v1.XmlPullParserException
print - print stream for reporting differencesschema - use schema adjustments in comparisons flag
org.xmlpull.v1.XmlPullParserException - on error creating parsers
public DocumentComparator(PrintStream print)
throws org.xmlpull.v1.XmlPullParserException
print - print stream for reporting differences
org.xmlpull.v1.XmlPullParserException - on error creating parsers| Method Detail |
|---|
protected static String buildPositionString(org.xmlpull.v1.XmlPullParser parser)
parser - for which to build description
protected static String buildName(String ns,
String name)
ns - namespace URIname - local name
protected void printError(String msg)
msg - error message text
protected boolean equalValues(String texta,
String textb)
texta - textb -
true if values match, false if notprotected boolean matchAttributes()
true if the attributes match, false if
not
protected boolean matchText(String texta,
String textb,
String lead)
texta - textb - lead - error text lead
true if the texts match, false if
notprotected boolean matchNames()
true if the names match, false if not
public boolean compare(Reader rdra,
Reader rdrb)
rdra - reader for first document to be comparedrdrb - reader for second document to be compared
true if the documents are the same,
false if they're different
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||