0
我正在使用Xpath 1.0表達式來查詢XML文檔。 我的目標是將所有選定的節點輸出到Jaspersoft報告中,該報告顯示一個新頁面以及每個Uid的相應數據。XPath多節點
這裏是我的XML文檔的一個片段,而我已經簡化:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<modules>
<Operation>
<Operation>
<wellUid lookupLabel="Well992454">cf1</wellUid>
</Operation>
</Operation>
<RigInformation>
<RigInformation>
<rigName>RigName12345</rigName>
<rigInformationUid>rig005</rigInformationUid>
<rigManager lookupLabel="Manager554">554</rigManager>
</RigInformation>
<RigInformation>
<rigName>RigName4578945</rigName>
<rigInformationUid>rig001</rigInformationUid>
<rigManager lookupLabel="Manager2254879">2254</rigManager>
</RigInformation>
</RigInformation>
<Well>
<Well>
<wellUid>cf1</wellUid>
<wellName>Name 1</wellName>
</Well>
<Well>
<wellUid>cf2</wellUid>
<wellName>Name 2</wellName>
</Well>
</Well>
<ReportDaily>
<ReportDaily>
<wellUid>cf1</wellUid>
<rigInformationUid>rig001</rigInformationUid>
</ReportDaily>
</ReportDaily>
</modules>
</root>
我試圖理清顯示所有wellUid下的信息的XPath表達式。因此,如果有一個wellUid「001」和一個wellUid「002」,那麼應該只有兩行返回來自Well,RigInformation,Operation和ReportDaily的所有信息。
RigInformation沒有wellUid,但確實有ReportInily也有的rigInformationUid。
這裏是我的查詢到目前爲止,我已經試過......
//ReportDaily/ReportDaily[wellUid = //Well/Well/wellUid] | //RigInformation/RigInformation[wellUid = //Well/Well/wellUid] | //Operation/Operation[wellUid = //Well/Well/wellUid] | //Well/Well[wellUid]
和
//Well/Well[wellUid and //ReportDaily/ReportDaily[wellUid = //Well/Well/wellUid and //Operation/Operation[wellUid = //Well/Well/wellUid and //RigInformation/RigInformation[rigInformationUid = //ReportDaily/ReportDaily/rigInformationUid]]]]
任何幫助將不勝感激。