我有以下XML:
int getLocationID(string name)
{
if(LocationMap.empty())
{
populateLocationMap();
}
return LocationMap[name];
}
我想选择共享相同LayoutRow值的所有字段。在XPath中可以做到吗?我试过<Section>
<Field>
<LayoutRow>1</LayoutRow>
<LayoutWeight>1</LayoutWeight>
</Field>
<Field>
<LayoutRow>1</LayoutRow>
<LayoutWeight>2</LayoutWeight>
</Field>
<Field>
<LayoutRow>2</LayoutRow>
<LayoutWeight>1</LayoutWeight>
</Field>
<Field>
<LayoutRow>2</LayoutRow>
<LayoutWeight>2</LayoutWeight>
</Field>
<Field>
<LayoutRow>3</LayoutRow>
<LayoutWeight>1</LayoutWeight>
</Field>
<Field>
<LayoutRow>3</LayoutRow>
<LayoutWeight>1</LayoutWeight>
</Field>
</Section>
和几个不同的尝试使用轴但没有运气。