1
所有节点我有一个XML查找与属性相匹配的模式
<mic_root state="mismatch">
<RepoTrade state="mismatch">
<TradeIds state="mismatch">
<TradeId state="mismatch">
<Id state="missing" />
<Id1 state="added" />
<Version state="mismatch">
<mic_elemA_text>1</mic_elemA_text>
<mic_elemB_text>2</mic_elemB_text>
</Version>
</TradeId>
<TradeId state="mismatch">
<Id state="mismatch">
<mic_elemA_text>1</mic_elemA_text>
<mic_elemB_text>2</mic_elemB_text>
</Id>
</TradeId>
</TradeIds>
<Fixings state="mismatch">
<mic_elemA_text>
</mic_elemA_text>
<mic_elemB_text>123</mic_elemB_text>
</Fixings>
<SpecificDetail state="mismatch">
<DirtyBondPrice mic_elemA_attr="%s="%s";%s="%s"" mic_elemB_attr="%s="%s";%s="%s"" state="mismatch" />
</SpecificDetail>
</RepoTrade>
</mic_root>
我需要找到所有那些有像mic_elem属性节点?_ ?????。例如,在上面的XML中,我需要获得DirtyBondPrice。我可以找到所有那些与代码类似的模式是这样的节点:
Set xmlMatches = objResultsXML.GetRootElement.ChildElementsByPath("//*[starts-with(local-name(), 'mic_elem')]")
这让我像<Version><mic_elemA_text><mic_elemB_text>
& <Id><mic_elemA_text><mic_elemB_text>
所有节点。
谢谢,这就像一个魅力。不能相信我没有尝试过这种组合。我需要了解更多关于xpath的信息。 –