我有一個這樣的XML文件,我只想獲得屬性中的值是「1」,應該是PHP代碼?提前致謝。如何使用PHP中的SimpleXML訪問XML屬性
<?xml version="1.0" encoding="UTF-8" ?>
<nodeInfo>
<node flag="128">
<address>18 F5 40 1</address>
<name>iMeterSolo</name>
<type>9.7.135.92</type>
<enabled>true</enabled>
<deviceClass>0</deviceClass>
<wattage>0</wattage>
<dcPeriod>0</dcPeriod>
<pnode>18 F5 40 1</pnode>
<property id="ST" ***value="1"*** formatted="1" uom="W" />
</node>
<properties>
<property id="ST" value="1" formatted="1" uom="W" />
<property id="TPW" value="226" formatted="226" uom="kWs" />
</properties>
</nodeInfo>
有3個元素與XML文檔中的 「值」 屬性。解釋代碼應該如何選擇閱讀哪一個。 –
LisMorski
2012-07-12 06:01:08