考慮下面的XML文檔:解析XML文檔轉換成單獨的XPath沒有文件預知
<Element0 AttributeA="A">
<Element1 AttributeB="1" AttributeC="C" AttributeD="D">
<Element2>nodeValue</Element2>
</Element1>
<Element1 AttributeB="2" AttributeC="C" AttributeD="D">
<Element2>nodeValue</Element2>
<Element3 AttributeE="E">
<Element4 AttributeF="F">nodeValue</Element4>
</Element3>
</Element1>
.
.
.
.
</Element0>
如何解析(切絲,去構建,翻譯)將文檔分成單獨的XPath(見下文)無預知xml文檔的內容?
//Element0[@AttributeA='A']/Element1[@AttributeB='1' and @AttributeC='C' and @AttributeD='D']/Element2
//Element0[@AttributeA='A']/Element1[@AttributeB='2' and @AttributeC='C' and @AttributeD='D']/Element2
//Element0[@AttributeA='A']/Element1[@AttributeB='2' and @AttributeC='C' and @AttributeD='D']/Element3[@AttributeE='E']/Element4[@AttributeF='F']
簡單,直接,快速......併成功!正是我需要的(包括你的位置)。謝謝@ Daniel-Haley! – EngineeringSQL 2013-03-05 03:47:52
@echoScout - 不客氣! – 2013-03-05 04:49:39