2013-03-07 103 views
0

我在羅克韋爾FTPC工作...我有一個XML,我想解析它從中獲取數據。解析羅克韋爾FTPC中的XML

這裏是我的xml:

<part> 
<partlist>part001</partlist> 
<partlist>part002</partlist> 
<partlist>part003</partlist> 
</part> 

我正在寫下面的代碼來獲取數據。

filePath = openFileDialog() 
doc=readDocument(filePath) 
node=selectSingleNode(doc,"/PartList") 
nodeList = selectNodeList(node, "Part") 
nodePartNo=selectNodeList(doc,".//PARTNO") 
// println(nodePartNo.value.toString()) 
// println(nodeList.item(0).pop()) 
println("The node list length is: " +nodeList.getLength()) 

幫助我檢索節點值。

謝謝。

回答

0

請使用getTextContent()爲(i)項.getTextContent()

這應該解決的問題