How to Travese a xml string
Posted by vmk271 (vmk271), 8 April 2005I need to find the node attributes(e.g permission in this case ) in the xml string. the sample string will look like this
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 2005If 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.
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho