我有以下 XML:
<A>
<Lot>
<Of>
<Various>
<Parents>
<Object NodeType="UsageType">
<Property Name="Descriptor" Value="A" Type="My.DescriptorType"/>
[...]
</Object>
<Object NodeType="UsageType">
<Property Name="Descriptor" Value="B" Type="My.DescriptorType"/>
[...]
</Object>
<Object NodeType="UsageType">
<Property Name="Descriptor" Value="C" Type="My.DescriptorType"/>
[...]
</Object>
</Parents>
</Various>
</Of>
</Lot>
</A>
我正在尝试选择具有子元素的对象元素,其中包含
<Property Name="Descriptor" Value="B" Type="My.DescriptorType"/>
。
我真的不知道如何进行此选择,因为这依赖于很多属性:
我已经尝试过以下方法:
//Object[@NodeType='UsageType' and Property@Name='Descriptor' and Property@Value='B']
但是它不起作用(而且我认为它不能确保它是具有这两个属性的相同“属性”。
知道如何实现吗?
//Object[@NodeType='UsageType' and Property[@Name='Descriptor' and @Value='B']]