Re: XML Parsing, starting out.

From: Date: Sat, 29 Apr 2006 22:58:29 +0000
Subject: Re: XML Parsing, starting out.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-235119@lists.php.net to get a copy of this message
sinai@simnet.is 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

« previous php.general (#235119) next »