1
我有以下XML結構:xPath.evaluate只返回一個節點
...
...
<CON>
<LANGUAGES>
<LANGUAGE>Deutsch</LANGUAGE>
<LANGUAGE>English</LANGUAGE>
</LANGUAGES>
<CON>
...
...
使用下面我的代碼,我試圖檢索語言,但是當我嘗試打印節點列表的長度,它只返回1.
XPath xPath = XPathFactory.newInstance().newXPath();
NodeList nl = (NodeList)xPath.evaluate("/CU_DATA/CU/CON/LANGUAGES", document, XPathConstants.NODESET);
System.out.println(nl.getLength());
// Output: 1
如何獲得兩種語言?
謝謝喬恩! :) – yonan2236