Forum Discussion
I'm sorry for my bad explanation i was in a hurry yeserday.
I didn't know that .pix was common for images and i'm trying to compare XML data.
The problem is that i don't know what i have to insert in this line
regEx.Expression := '(?i)\d{1,2}.\d{1,2}.\d{2,4}\s\d{1,2}:\d{2}:\d{2}\w{2}';
No matter what i try i end up with the result that the files are equal even when they are not equal.
There are 2 parts where the files differ, the ID and the Date.
Can you give me an example how i can get the script to ignore the ID wich i showed in the previous post ?
Actually, what I would do is not use a pure file to file comparison like that at all. These are XML files and you can actually compare node to node and, if there are nodes you don't want to compare, simply skip them.
I'd write a routine (and I don't have time to do it right now) that would utilize MSXML.DOMDocument objects to grab the two XML files into DOM objects. Then, you could write a function that would grab a particular child node from one file, grab the related one from the other file, and compare the contents to see if they match. This even has the advantage that you can target particular sections and compare them rather than having to do the whole file. For example, your application performs a process that updates only 2 or 3 nodes within the XML file. Rather than having to compare the whole file, just check those 2 or 3 nodes.
There's a good bit of documentation out there online on how to utilize the MSXML.DOMDocument objects to compare XML files.
If you don't want to go the route of a customly created routine, you could always use XMLCheckpoints.
- tristaanogre8 years agoEsteemed Contributor
Took me a bit to get to this but I had remembered that SmartBear has documentation that gives some examples of how to use the XML Document object to process XML files.
https://support.smartbear.com/testcomplete/docs/testing-with/advanced/working-with-external-data-sources/files/xml.htmlIt's doesn't give specifics on how to write a routine to compare one node to another node, but this should be a good starting place.
Related Content
Recent Discussions
- 22 hours agodhundley