/// <summary> /// Compare Two Xmls /// </summary> /// <param name="string1">The first Xml</param> /// <param name="string2">The second Xml</param> /// <param name="nodesShouldIgnoreChildrenSequence"> /// Array of name of xml nodes whose children /// sequence should be ignored /// </param> /// <returns> /// XmlCompareResult /// </returns> public static XmlCompareResult Compare(string string1, string string2, string[] nodesShouldIgnoreChildrenSequence) { _nodesShouldIgnoreChildrenSequence = nodesShouldIgnoreChildrenSequence; XmlCompareResult result; // Parameter Validation if (null == string1) { throw new ArgumentNullException("string1"); } if (null == string2) { throw new ArgumentNullException("string2"); } Stream stream1 = null, stream2 = null; try { //change the content to streams stream1 = IOHelper.ConvertTextToStream(string1); stream2 = IOHelper.ConvertTextToStream(string2); //call the method for streams result = Compare(stream1, stream2, nodesShouldIgnoreChildrenSequence); } finally { //clean up if (null != stream1) { stream1.Close(); } if (null != stream2) { stream2.Close(); } } return(result); }