2012-09-25 179 views
0

我有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> 
+0

你有什么尝试?另外,你如何访问Xml文档?任何编程语言?或者只是使用XPath表达式? –

+0

你在用什么语言? – CrazyCasta

+0

对不起,我更新我的问题。我正在使用java,尝试使用marshall和unmarshall但不工作 – senzacionale

回答

相关问题