Comparing trees (ie. an XML document) is a bit more complicated than comparing two lists (like the lines in two files).
It's unclear from your question how extensive a comparison you're looking for here, but if you're only interested in testing a single value or attribute between two XML documents, the easiest is probably with Select-Xml:
$xml1 = [xml]@'
<root>
<nodegroup>
<node name="myNode">SomeValue</node>
</nodegroup>
</root>
'@
$xml2 = [xml]@'
<root>
<nodegroup>
<node name="myNode">SomeOtherValue</node>
</nodegroup>
</root>
'@
$res1,$res2 = $xml1,$xml2 |Select-Xml -XPath 'root/nodegroup/node[@name = "myNode"]'
if($res1.Node.InnerText -eq $res2.Node.InnerText){
# the inner text value of the selected node is the same in both documents
}
Get-Objectand what does it do?