[thelist] parsing my XML result in php

Toby Boudreaux tj at tobyjoe.com
Fri Dec 27 10:25:01 CST 2002


sorry, i realized that wasn't a very helpful post.

when using SAX, I tend to do the execution/processing of the data on
the element close handler.

what i just sent was for opening.

where i have:

#	do something

you could just store the attributes (sent as an array: the $atts arg)
and the element name ($name) in a stack.

then, when you create a cdata handler, you could check to see what the
last opened element was and switch on that, like you did with the
opening handler.

push the cdata onto a stack, then wait for the closing tag.

when you encounter the closing tag, switch on the $name and process the
cdata and attributes array at the top of your stack.


i haven't yet had coffee and am likely doing a poor job explaining
this. sorry :)




More information about the thelist mailing list