Forum Discussion

ecrespo's avatar
ecrespo
Occasional Contributor
13 years ago

How can I compare two .xps files?

I'm currently using TC 8.70

I do have to compare two .xps files. Since they are inherently xml files, I thought I could follow the procedure outlined in the Help to compare XML files from a script. However, when creating the checkpoint the following Exception is raised:

The document is invalid. Error: An invalid character was found in text content.



The code I'm using is directly from the TC Help manual:

function CreateXMLDemo()

{

  var XMLDoc;



  // Checks if NewXMLCheckpoint already exists in the Stores | XML collection.

  if (! XML.Contains("NewXMLCheckpoint"))

    {

    // Creates an IXMLDOMDocument object.

    XMLDoc = Sys.OleObject("Msxml2.DOMDocument.6.0");

    XMLDoc.async = false;

    // Loads data form the XML file to the IXMLDOMDocument object.

    var TestingDirectory = Application.GetTestingDirectory("HB003\\");

    var fileExpected = TestingDirectory + "eReport.xps";

    XMLDoc.load(fileExpected);



    // Creates NewXMLCheckpoint and checks if the creation is successful.

    if (XML.CreateXML("NewXMLCheckpoint", XMLDoc)) //--> This is where it fails

}



Thanks in advance for your help
  • Hi,



    XPS files are packed XML, and you cannot work with them as with simple XML files. You should unpack your file (for example, by just renaming filename.xps to filename.zip and unzipping it) before you can work with its XML contents.