Re: XML Parsing, starting out.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mattias Thorslund wrote:

sinai@xxxxxxxxx wrote:
Hello, 1st msg here so im excited what results i will get :)

Im a novice with php parsing and have been able to help myself quite well with what ive needed with xml_parse_into_struct and then echoing the fixed variable names but now im dealing with an xml document that is 1st quite large and 2nd changing gradually over time with either added data or changed information. (But not in large numbers)

http://www.camelotherald.com/xml/spells-si.xml

It is a spell listing for an online mmorpg. It has a "spell_list" that captures all other tags and a "spell_line" for each spell line. Within each spell line is a "spell" which has the detailed info for each spell with in the "spell_line"

I could parse this by echoing the fixed variables but due to its size and the changes done over time its just to much work. This is why i come to a stop. Ive read some guides and tried some example code that should help me through this.

What i hoped to get is an example with the xml i provided so i could work with it to complete the project.

The example could look something like this:

Header with the selected "spell_line" name ie. "Calefaction" and below that the spell info in some dummy table format. Then the next "spell_line" which is "Path of Earth" then with the spell info in some dummy table setup.

Thanks for reading and i hope someone can show me the light of a real xml parse.

The comments on the Manual page
[http://www.php.net/manual/en/ref.xml.php] contain an example class that
parses an XML file into an associative array. I'm using something
similar myself, as it seems to be a pretty straightforward way to get an
easy-to-use structure in PHP 4 without dom_xml, which isn't always
available.

Mattias

I have been trying as i said above with the php.net examples, the sitepoint examples (which have been great to give me some view of what i need and how it functions basicly) but with no luck. I can make it easy with fixed value but the dynamic part of it is still outside my reach for now. Thanks for the examples Matt and Richard

- olafurw

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux