[thelist] [PHP] parsing xml

Burhan Khalid thelist at meidomus.com
Mon Aug 25 01:13:50 CDT 2003


Quoting Paul Bennett <paul at teltest.com>:

> Greetings fellow 'volters
> 
> I am parsing an xml file from a seperate application and placing the 
> data into a database.

[ snip ]

> 
> Example 1:
> The parent tag for each major data grouping is:
> "Programme"
> This tag name also appears under the node "Fees", thus my parser thinks 
> that when it hits this tag that the programme information is complete 
> and all heckfire breaks loose.
> 
> Example 2:
> The title of each "Programme" is contained within the tag "Title", but 
> this tag also is present under a node named "Careers"
> [Insert sobbing sound here]
> 

[ /snip ]

Paul :

  If you are using the domxml extensions, then you can get the parent node for 
the current tag. If you are using the default expat parser, then you'll have 
to keep track of each suspect tag with a flag.

DOM XML : http://www.php.net/manual/en/ref.domxml.php
http://www.php.net/manual/en/function.domnode-parent-node.php

  Easy way to find out if domxml is enabled is good ol' phpinfo();

-- 
Burhan Khalid
thelist[at]meidomus[dot]com
http://www.meidomus.com


More information about the thelist mailing list