PHP Classes

Obtaining a data array of XML element values

Recommend this page to a friend!

      Generic XML parser class  >  All threads  >  Obtaining a data array of XML...  >  (Un) Subscribe thread alerts  
Subject:Obtaining a data array of XML...
Summary:How do you obtain an array of the xml values
Messages:2
Author:kirk
Date:2008-03-14 13:36:08
Update:2008-03-14 20:27:09
 

  1. Obtaining a data array of XML...   Reply   Report abuse  
Picture of kirk kirk - 2008-03-14 13:36:08
I'm probably missing something obvious, but how is it that you obtain an array of the element values as found in xml_parser?

  2. Re: Obtaining a data array of XML...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-03-14 20:27:09 - In reply to message 1 from kirk
The class parses the XML document and stores its structure in a class variable named structure.

That is an associative array that associates the path of its element with the element values. Data elements are strings. Tag elements are associative arrays with the tag name and attributes.

The element paths are strings with the number of the element preceded by the path of the parent element, using commas to separate the element number and the parent element path.

You need to traverse the structure array to find the elements within the path you want and then access their values.