开发者

XmlDiff.Compare with XmlNodeList

I need to compare only specific nodes from two XML files.

Suppose if both the XML structure is as below:

XML 1:

<Species>
    <Human>
        <Number>2</Number>
    </Human>
    <Human>
        <Number>3</Number>
    </Human>
    <Human>
        <Number>10</Number>
    </Human>
    <Bird>
        <Number>20</Number>
    </Bird>
    <Human>
        <Number>8</Number>
    </Human>
</Species>

XML 2:

<Species>
    <Human>
        <Number>2</Number>
    &开发者_开发知识库lt;/Human>
    <Bird>
        <Number>2</Number>
    </Bird>
    <Human>
        <Number>8</Number>
    </Human>
    <Human>
        <Number>3</Number>
    </Human>
    <Human>
        <Number>10</Number>
    </Human>
    <Bird>
        <Number>20</Number>
    </Bird>
</Species>

I want to compare all the "Human" nodes, so I will declare an XMLNodeList and populate its values using XMLNode.SelectNode("//Species/Human")

But I can pass only XmlNode in XMLCompare. Also I need to apply IgnoreChildOrders for the XMLDiffPatch tool : I am using "Compare" method.

How do I pass a XmlNodeList to Compare method?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜