| |||||||||||
| |||||||||||
How to Travese a xml string Posted by vmk271 (vmk271), 8 April 2005 I need to find the node attributes(e.g permission in this case ) in the xml string. the sample string will look like thisXMl string ------------- <corp> <report permission="10"> <abstract permission="4"/> <transfer permission="10"/> <summary permission="5"/> <billing permission="10"/> <annuity permission="0"/> </report> </corp> how can i write a php function , the argument to the function will be the xpath(e.g corp/billing/@permission) and the output will be the permission value(e.g 10). Is there is any inbuilt function in php? Posted by admin (Graham Ellis), 9 April 2005 If you're familiar with Xpath, have a look at the php.Xpath package on Sourceforge at http://sourceforge.net/projects/phpxpath/. The documentation is at http://www.carrubbers.org/scripts/php/xpath/doc/. Not used it myself, but it looks like it might be the sort of thing you're looking for. There's a quick start guide to using Xpath in PHP with this package at http://jm3.net/misc/php-xpath-quickstart/ - examples of the sort of thing you're looking for in just half a dozen lines of code.This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |