我有XML作爲字符串,並且此XML字符串具有多個節點:例如4 billingDetail節點。如何解析字符串並獲得4個節點再次輸出爲字符串?如何從字符串xml中再次獲取字符串作爲字符串
我正在使用JAVA。我嘗試用馬歇爾,然後解組,但速度慢,無法正常工作
例子:
<?xml version="1.0" encoding="UTF_8" standalone="yes"?>
<StoreMessage xmlns="http://www.alo.com/feed">
<billingDetail>
<billingDetailId>987</billingDetailId>
<contextId>0</contextId>
<userId>
<pan>F0F8DJH348DJ</pan>
<contractSerialNumber>46446</contractSerialNumber>
</userId>
<declaredVehicleClass>A</declaredVehicleClass>
</billingDetail>
<billingDetail>
<billingDetailId>987</billingDetailId>
<contextId>0</contextId>
<userId>
<pan>F0F8DJH348DJ</pan>
<contractSerialNumber>46446</contractSerialNumber>
</userId>
<declaredVehicleClass>A</declaredVehicleClass>
</billingDetail>
<billingDetail>
<billingDetailId>987</billingDetailId>
<contextId>0</contextId>
<userId>
<pan>F0F8DJH348DJ</pan>
<contractSerialNumber>46446</contractSerialNumber>
</userId>
<declaredVehicleClass>A</declaredVehicleClass>
</billingDetail>
<billingDetail>
<billingDetailId>987</billingDetailId>
<contextId>0</contextId>
<userId>
<pan>F0F8DJH348DJ</pan>
<contractSerialNumber>46446</contractSerialNumber>
</userId>
<declaredVehicleClass>A</declaredVehicleClass>
</billingDetail>
</StoreMessage>
你有什麼嘗試?另外,你如何訪問Xml文檔?任何編程語言?或者只是使用XPath表達式? –
你在用什麼語言? – CrazyCasta
對不起,我更新我的問題。我正在使用java,嘗試使用marshall和unmarshall但不工作 – senzacionale