Posts

Java Program to Compare two XML's Ignoring stanza Ordering

Java Program To Compare Two XML's Ignoring Stanza Ordering

import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; public class XMLComparison {     public static void main(String s[]) throws ParserConfigurationException, SAXException, IOException{         compareTwoXMLS("<a><b>testb</b><c>testc</c></a>","<a><c>testc</c><b>testb</b></a>");     }     public static void compareTwoXMLS(String xml1, String xml2) throws ParserConfigurationException, SAXException, IOException {         //Convert the two xml's into two maps where each of the elements of XML along wi