Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems
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 this

XMl string

  <report permission="10">
   <abstract permission="4"/>
   <transfer permission="10"/>
   <summary permission="5"/>
   <billing permission="10"/>
   <annuity permission="0"/>

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 The documentation is at  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 - 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 and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2018: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: • WEB: • SKYPE: wellho