【发布时间】:2012-06-30 02:23:50
【问题描述】:
在 DB 中,我将 XML 字符串存储在列中。下面是我的 XML 结构:
<?xml version="1.0"?>
-<ProductAttributes xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-<Attribute Required="false" ID="2" Name="Color">
<Value ID="18">Light Pink</Value>
</Attribute>
-<Attribute Required="false" ID="1" Name="Size">
<Value ID="9">XL</Value>
</Attribute>
</ProductAttributes>
另一个 XML 是:
<?xml version="1.0"?>
-<ProductAttributes xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-<Attribute Required="false" ID="1" Name="Size">
<Value ID="1">S</Value>
</Attribute>
-<Attribute Required="false" ID="2" Name="Color">
<Value ID="4">Red</Value>
</Attribute>
-<Attribute Required="false" ID="3" Name="Weight">
<Value ID="6">10gr</Value>
</Attribute>
</ProductAttributes>
备注
可以有n个xml字符串,每个xml字符串可以有m个标签
属性节点可以有不同的顺序,例如在第一个属性中,Id=1 可以是第一个属性,在第二个属性中,Id=1 可以是最后一个。
要求不是比较这 n 个 XML 字符串,而是查找任何字符串是否具有完全重复的属性(此比较将考虑值,因为顺序可能不同)。
请指导和帮助我。
【问题讨论】:
标签: c# .net xml linq-to-xml