Click here to get back home

problem with xml and xpath in PHP

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
problem with xml and xpath in PHP amit 07-03-2008
Posted by amit on July 3, 2008, 10:11 pm
Please log in for more thread options

hello group,

I need to extract information from an XML file (http://
wurfl.sourceforge.net/wurfl.xml). Now, using following function I'm
able to read the user_agent's value:

$devices = $xml->xpath('devices/device/@user_agent');

But when I try to read "Capability" element vlaue which is "Audivox" I
don't get anything. or if I try to read "model_name" it will return
nothing!

$capability = $xml->xpath('devices/device/group/capability/
@value');


How should I address value="Audiovox" ?



Thanks.


A block sample of the XML I'm reading.

<devices>
<device user_agent="AUDIOVOX-CDM180" actual_device_root="true"
fall_back="generic" id="audiovox_cdm180_ver1">
<group id="product_info">
<capability name="brand_name" value="Audiovox"/>
<capability name="model_name" value="CDM-180"/>
</group>
</device>
</devices>


Similar ThreadsPosted
PHP5 Xpath problem August 18, 2004, 11:08 am
Xpath encoding problem February 11, 2008, 11:29 am
XPath help? April 5, 2008, 12:02 pm
The use of fn: functions in XSL - XPath June 23, 2005, 9:14 pm
xpath XML and PHP4 November 30, 2006, 6:28 pm
php5: question about xpath January 25, 2005, 10:05 pm
pass variable to xpath? February 1, 2005, 5:23 pm
xpath query too long? June 25, 2008, 1:43 am
Struggling with simple DOM/XPath usage... February 4, 2005, 6:13 pm
simplexml with xpath, getting index of results January 2, 2006, 2:31 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap