0
我有一個XML,它看起來像獲取XML節點的localName
<Personnel>
<Employee type="permanent">
<Name>Seagull</Name>
<Id>3674</Id>
<Age>34</Age>
</Employee>
<Employee type="contract">
<Name>Robin</Name>
<Id>3675</Id>
<Age>25</Age>
</Employee>
<Employee type="permanent">
<Name>Crow</Name>
<Id>3676</Id>
<Age>28</Age>
</Employee>
</Personnel>
我試圖讓每一個節點的名稱,然後才能從那裏值,但我一直都想與空或當我做下面的空字符串:
child.getLocalName()等於(「永久」)
它拋出異常,因爲child.getLocalName()爲null 我檢查了孩子在調試器和我看到localName =「permanent」
有沒有人熟悉這種奇怪的行爲?
你們是不是拿每個節點的值? –
Ars