Hi All,
I have to parse an xml file with PHP to an object. At the moment I don't have a clue how to do this, help is appreciated.
The xml is quite big. I have to parse a part of it which looks like this:
<someNamespace:xmlDocument>
<someNamespace:categories>
<category name="Patrick" anAttribute="numericValue" anotherAttribute="numericValue">
<category name="Andrew" anAttribute="numericValue" anotherAttribute="numericValue">
<category name="Alice" anAttribute="numericValue" anotherAttribute="numericValue">
<category name="Thomas" anAttribute="numericValue" anotherAttribute="numericValue">
<category name="Michael" anAttribute="numericValue" anotherAttribute="numericValue"/>
<category name="Matthew" anAttribute="numericValue" anotherAttribute="numericValue"/>
</category>
<category name="Janet" anAttribute="numericValue" anotherAttribute="numericValue">
<category name="Steven" anAttribute="numericValue" anotherAttribute="numericValue"/>
<category name="Christopher" anAttribute="numericValue" anotherAttribute="numericValue"/>
</category>
<category name="Sue" anAttribute="numericValue" anotherAttribute="numericValue"/>
</category>
<category name="Charles" anAttribute="numericValue" anotherAttribute="numericValue">
<category name="John" anAttribute="numericValue" anotherAttribute="numericValue">
<category name="Charles" anAttribute="numericValue" anotherAttribute="numericValue"/>
<category name="Rosamund" anAttribute="numericValue" anotherAttribute="numericValue"/>
<category name="Stuart" anAttribute="numericValue" anotherAttribute="numericValue"/>
<category name="Rosamund" anAttribute="numericValue" anotherAttribute="numericValue"/>
</category>
<category name="John" anAttribute="numericValue" anotherAttribute="numericValue"/>
</category>
</category>
<category name="Oliver" anAttribute="numericValue" anotherAttribute="numericValue">
<category name="Jane" anAttribute="numericValue" anotherAttribute="numericValue"/>
<category name="Lucy" anAttribute="numericValue" anotherAttribute="numericValue">
<category name="David" anAttribute="numericValue" anotherAttribute="numericValue"/>
<category name="Robert" anAttribute="numericValue" anotherAttribute="numericValue"/>
<category name="Hetty" anAttribute="numericValue" anotherAttribute="numericValue">
<category name="Kenneth" anAttribute="numericValue" anotherAttribute="numericValue"/>
<category name="Jonathan" anAttribute="numericValue" anotherAttribute="numericValue"/>
</category>
<category name="Freddy" anAttribute="numericValue" anotherAttribute="numericValue"/>
<category name="Virginia" anAttribute="numericValue" anotherAttribute="numericValue"/>
</category>
</category>
</category>
</someNamespace:categories>
Every "name" and "anAttribute" attribute is unique.
What I would like to have afterwards is an categories object with many category objects...
Thanks!