|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.gridsystems.GridXMLComparator
public class GridXMLComparator
"Logical" comparator for XML trees.
This class implements a "relaxed" comparison between two XML documents. Starting from the document root elements, a recursive comparison is performed for each pair of nodes, using the following criteria to determine their equivalency:
<field> <value>123</value> </field> <field><value>123</value><field>
Constructor Summary | |
---|---|
GridXMLComparator()
Creates an instance. |
Method Summary | |
---|---|
boolean |
compare(org.w3c.dom.Document d1,
org.w3c.dom.Document d2)
Compares the given documents. |
boolean |
compare(org.w3c.dom.Element elem1,
org.w3c.dom.Element elem2)
Compares the given elements. |
boolean |
compare(java.io.File f1,
java.io.File f2)
Compares two XML documents for equivalency. |
boolean |
compare(java.io.Reader xml1,
java.io.Reader xml2)
Compares two XML documents for equivalency. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GridXMLComparator()
Method Detail |
---|
public boolean compare(java.io.Reader xml1, java.io.Reader xml2) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
xml1
- A reader containing the first document to comparexml2
- A reader containing the second document to compare
org.xml.sax.SAXException
- If a syntax error is found in one of the XML trees
java.io.IOException
- If an I/O error occurs reading the sources
javax.xml.parsers.ParserConfigurationException
- If the builder cannot be instantiatedpublic boolean compare(java.io.File f1, java.io.File f2) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
f1
- A file containing the first document to comparef2
- A file containing the second document to compare
org.xml.sax.SAXException
- If a syntax error is found in one of the XML trees
java.io.IOException
- If an I/O error occurs reading the sources
javax.xml.parsers.ParserConfigurationException
- If the builder cannot be instantiatedpublic boolean compare(org.w3c.dom.Document d1, org.w3c.dom.Document d2)
d1
- The first documentd2
- The second document
public boolean compare(org.w3c.dom.Element elem1, org.w3c.dom.Element elem2)
elem1
- Left element to compareelem2
- Right element to compare
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |