PHP中,如何读取XML文件中的元素值
在PHP中,如何读取XML文件中的元素值,如下面的XML文件。如:我只读取元素“productName”对应的值。
<?xml version='1.0' encoding='UTF-8'?>
<RDNProductExport xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<productProfile>
<productProfileName>Rttu</productProfileName>
<product>
<productID>37</productID>
<productData>
<entityID>37</entityID>
<productName>Uus testamentti CD</productName>
<productNumber></productNumber>
<productPrice>59.00</productPrice>
<vatPercent>22.00</vatPercent>
<dateCreated></dateCreated>
<publishingDate>toukokuu 2005</publishingDate>
<internalComment>NULL</internalComment>
<coverMakerID>9078</coverMakerID>
<supplierID></supplierID>
<publisherID></publisherID>
<dateModified>0000-00-00 00:00:00</dateModified>
<attachments>
<attachment>
<fileID>82</fileID>
<fileTitle>4424_ti.jpg</fileTitle>
</attachment>
<attachment>
<fileID>83</fileID>
<fileTitle>4424_i1.jpg</fileTitle>
</attachment>
<attachment>
<fileID>84</fileID>
<fileTitle>4424_p.jpg</fileTitle>
</attachment>
</attachments>
</productData>
</product>
</productProfile>
</RDNProductExport>