create php objects from xml

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Niall Linden

    create php objects from xml

    dear all

    sorry for asking what is probably a simple question. What i want to do
    is create objects from an XML file.
    basically my tags are all object elements or attribute values ie each
    indent is a new object. the classes for these objects are already
    written, just the objects need to be created
    eg

    <object1>
    <value1>23</value1>
    <value2>hello </value1>
    <object2>
    <value3>test1 </value3>
    <value4>23</value4>
    <object3>
    <value1>100</value1>
    <\object3>
    </object2>
    <object2>
    <value3>test3 </value3>
    <value5>50</value5>
    </object2>
    </object1>

    i have classes for object1,2,3 that have definitions for the various
    types that they will have.

    what this should return (create) is an object of type object1. in this
    there is an array of 2 objects of type object2 along with attributes
    of type value1 and value2 with their values.

    the first instance of object2 also has a instance of object3 which
    has an attribute of type value 1 which equals 23

    i have looked at all the exparsing, but it is more for viewing, and i
    cant get them adaptd

    basically just need something that can break the file down into its
    indenting. there are only 3 objects deep in the xml before we reach
    nodes with no children.

    TIA

    niall
Working...