com.gridsystems
Class GridXMLComparer

java.lang.Object
  extended by com.gridsystems.GridXMLComparer

Deprecated. This class has been replaced by GridXMLComparator

public class GridXMLComparer
extends java.lang.Object

"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:

  1. XML comment clauses are ignored.
  2. Text nodes among nested elements are ignored.
  3. Both elements must have the same name, and same attribute set (the attribute order is not important).
  4. If both elements contain a single child of type TEXT, the contents must be the same for both nodes.
  5. Both elements must have the same number of child elements
  6. For each child element in the "left" element, an equivalent element must be present in the "right" one. This equivalence is determined through a recursive call to the same comparison algorithm. The order of children elements is not taken into account.
NOTE: Ignoring text nodes among elements allows the following two XML fragments to be considered as equivalent:
   <field>
     <value>123</value>
   </field>

   <field><value>123</value><field>
 

Version:
2.0
Author:
Job Torres, Rodrigo Ruiz

Constructor Summary
GridXMLComparer()
          Deprecated. Creates an instance.
 
Method Summary
 boolean compareXMLs(java.io.Reader xml1, java.io.Reader xml2)
          Deprecated. Logically compares two XML documents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridXMLComparer

public GridXMLComparer()
Deprecated. 
Creates an instance.

Method Detail

compareXMLs

public boolean compareXMLs(java.io.Reader xml1,
                           java.io.Reader xml2)
                    throws org.xml.sax.SAXException,
                           java.io.IOException,
                           javax.xml.parsers.ParserConfigurationException
Deprecated. 
Logically compares two XML documents.

Parameters:
xml1 - First document to compare
xml2 - Second document to compare
Returns:
true if both documents are equal, false otherwise
Throws:
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 instantiated


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.