2011-12-12 21 views
1

我有下面的XML:關於Xpath的

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:axis="http://ws.apache.org/axis2"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <axis:ErrorQueueInput> 
     <errorStr>JIRA Topic</errorStr> 
     <InputMessage> <a>jira message</a><b>jira2 msg</b> </InputMessage> 
     </axis:ErrorQueueInput> 
    </soapenv:Body> 
</soapenv:Envelope> 

,我需要得到的輸出爲:

<a>jira message</a><b>jira2 msg</b> 

如果我把我的XPath等;

//soapenv1:Envelope/soapenv1:Body/axis:ErrorQueueInput/InputMessage 

輸出是一樣的東西:

jira message jira2 msg 

如果我嘗試這樣的:

//soapenv1:Envelope/soapenv1:Body/axis:ErrorQueueInput/InputMessage//child::* 

輸出(這是不對的):

jira message 

我怎樣才能獲取整個XML(即:<a>jira message</a><b>jira2 msg</b>)作爲我的輸出?

+0

您如何評估XPath? –

+0

像這樣;(使用xslt) Ratha

回答

2

無論您使用什麼來評估xpath,都會將節點值強制爲字符串。既然你沒有說你在做什麼,我們不能告訴你什麼是錯的。

如果您正在使用XSL,可能您在使用value-of時應該使用copy-of

+0

im using xslt;代碼是; 你能改正這個嗎? – Ratha

+0

非常感謝大量的作品 – Ratha