Is there a way to compare two xml nodes in Delphi?
I am using the MSXML parser and loading the xml into an IXmlDOMDocument2. The nodes are stored in an IXmlDOMNode.
I would be ok using Delphi's TXMLDocument if it helps. I do not want to download any third party components.
I just want to compare the structures of the nodes, not the values.
I saw a similar post/utility for Java, but nothing for Delphi.
Thank you!
Since you want to compare only the structure, you could convert your nodes into 'full paths' and compare them as strings.
E.g. Let's assume the trees:
Tree A
Tree B
From the conversion to 'full paths' you'd get:
Tree A
Tree B
By iterating on the lists of full paths you can quickly check and compare if they exist in the other tree. You can also easily find the nodes on the tree.