Jump to content

xml parsing


Goose

Recommended Posts

I am going to be parsing an XML file that looks like the following. Basically I want to know what functions I need to call in order to get the XML parsed. I have been to the w3schools website and understand how to initiate the parser object I just don't know what to do after that. In my example there can be many <room> elements, many <message> elements and <user> elements. Thanks in advance!

 

Note: I can handle looping and all that jazz, I just want to know how to get the count of certain elements and how to get the values of certain elements. Examples would be awesome!

 

<room>

<name>Default</name>

<id>1</id>

<messages>

<message>

<usr>goose</usr>

<msg>Hello everyone!</msg>

</message>

<message>

<usr>goose</usr>

<msg>This is an XML example.</msg>

</message>

</messages>

<users>

<user>

<uid>1</uid>

<usr>goose</usr>

</user>

</users>

</room>

Link to comment
https://forums.phpfreaks.com/topic/46822-xml-parsing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.