Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Storing file information to compare later

$
0
0

I guess I see three types of differences that can exist between XML files, off the top of my head:

  • Elements (or trees of elements) that exist in one file but not the other.
  • Elements that exist in both files, but have different attributes (or the same attributes with different values; possibly two categories of difference here.)
  • Elements that exist in both files, with different inner text data.

The code to check for these types of differences in the tree is not too bad (it’ll probably involve some sort of recursive function to walk the tree of elements in both files), but you’d have to decide how best to represent these differences in the output. In particular, what if an entire tree of XML elements is missing from one file?

Maybe for your purposes, you don’t need it to be quite this generic, and just want to check the elements / attributes that are defined in your authoritative XML code. That’s easier to write, and you can simply report on whether the authoritative elements / attributes exist in the file you’re reading, and if their values are the same.


Viewing all articles
Browse latest Browse all 13067

Trending Articles