[thelist] parsing my XML result in php
Toby Boudreaux
tj at tobyjoe.com
Fri Dec 27 10:18:01 CST 2002
Tom - I think you're best off using a SAX parser.
Just check the name of the element that is opened against whatever
you're looking for.
A light example might be:
function elementOpening($parser, $name, $atts){
switch($name){
case 'ProductNumber':
# do something here
break;
case 'Description':
# do something here
break;
default:
break;
}
}
remember to set the CASE_FOLDING option to false when you create your
parser.
it's really easy, though I know it sounds a little overwhelming.
the site has only fair documentation, but it's helpful enough:
http://www.php.net/xml
> <?xml version="1.0"?>
> <XTE>
> <Response type="Product" txnid="pm01"
> timestamp="2002-12-27T15:51:34Z">
> <Outcome>Success</Outcome>
> <Product>
> <Description/>
> <ProductName>Kiddush Cup #1052</ProductName>
> <ProductNo>117</ProductNo>
> </Product>
> </Response>
> </XTE>
> ----------------------------------
More information about the thelist
mailing list