Best way to do comparisons

reactancexlreactancexl Posts: 147

I have a src XML file (8 Meg) which correlates to 6800 records in a DB. I want to be able to compare varSRC = xmlMsg to varDB = DBXml message returned from DB. Diff is really really slow. I adjusted Eclipse.ini parameters to no avail. I used the XML assertor and it fails even though when you compare the two messages (xml)they are identical. What is the best way or setting for this? thx



  • benken_parasoftbenken_parasoft Posts: 1,018 ✭✭✭

    Diff is really really slow

    Make sure you selected "XMLUnit" for the XML diff engine in the Diff tool. XMLUnit works pretty fast, even on large documents. However, if there are hundreds or thousands of differences being reported then that could really slow things down in which case you should try to see what's so different about the two documents being compared.

    I adjusted Eclipse.ini parameters to no avail

    What were you trying to change? Were you trying to increase the JVM heap size? This must be done on the command line. In particular, you can give Java more memory by passing and -J-Xmx argument to soatest.exe. For example, to allow Java to allocate 4GB for its heap you can run "soatest.exe -J-Xmx4G"

    I used the XML assertor and it fails even though when you compare the two messages (xml)they are identical

    The XML Assertor is good for asserting on specific values from an XML document and ignore everything else. If you want to compare two XML documents in their entirety then you should use the Diff tool.

  • reactancexlreactancexl Posts: 147

    I have the scenario of thousands of comparisons, which leads is leading me not to use "Diff Tool". What is the alternative? Save the two message files off to disk and use a script to do the comparision?

  • benken_parasoftbenken_parasoft Posts: 1,018 ✭✭✭
    edited October 2018

    You are just comparing two XML documents for equality, right? The Diff tool is the right tool for comparing two XML documents against each other and the XMLUnit engine, if selected, has very good performance, even for large documents with thousands of elements.

    It may help for you to better explain what you see happening. The only thing that I can guess at this point is that maybe the diff is finishing quickly but maybe you are getting too many differences being reported. Do you see many differences being reported to the Quality Tasks view while the Diff tool is running? If not, what do you see happening exactly?

  • reactancexlreactancexl Posts: 147

    I think I know what is happening but not sure what is the best way to resolve. I assign the source XML message to a Variable via the Databank. The output is not "beautify". It is a single line. The XML from the DB is "Beautify" therefore the diff does not like it when I compare the two.

  • benken_parasoftbenken_parasoft Posts: 1,018 ✭✭✭
    edited October 2018

    Make sure your Diff tool is in XML mode and not Text mode. The XML diff engine will automatically ignore textual differences that do not change semantics, like choice of quote character around XML attributes, or choice of namespace prefix names, or "unimportant" whitespace before or after start or end tags. In other words, if you were to take two XML documents that were exactly the same, then beautify one and not the other, then the XML diff will still pass without reporting any differences, since the messages are considered equivalent.

Sign In or Register to comment.