[Expat-discuss] Nested calls to XML_Parse

Dan Rosen dr at netscape.com
Wed Jun 11 19:16:58 EDT 2003


Interesting application, and I understand now why you desire the ability 
to get the parsed data as if the dynamic insertion were transparent. It 
seems like the right thing to do in your case would be to make multiple 
parser instances, but register the same callback functions for each 
parser. That would give you the same transparency from the application 
code, since the order in which the parser callbacks are invoked should 
be correct. But definitely multiple parser instances are the way to go, 
in your case, hands down.

You might be able to optimize the number of new parser instances you 
dynamically create and destroy. Some sort of list or stack ought to do...

Best,
dr

Derek Snider wrote:

> I guess I should add a bit of case history here.  Without going into too
> much detail, what we have is an Apache/PHP based (which uses libexpat)
> website management system that does interface layouts using XML template
> files.
> 
> This system has evolved over the past year and a half as a
> scratch-rewrite from a "plain PHP" interface for the purpose of making
> things far more dynamic, easy to code and also support multiple
> languages.
> 
> Not being XML wizards, the system we devised is relatively simple, but
> makes use of recursive calls to xml_parse to expand certain tags as well
> as embedded variables into XML data.  (One example is that an embedded
> variable such as $GETDISKUSAGE will result in a call to a PHP function
> to lookup the disk usage for a customer, and expand to XML tags
> containing the data in the proper formatting.)
> 
> Everything worked fine for the past year and a half until we tried to
> upgrade to php-4.3.2.  I don't know why it worked (since libexpat does
> not support this), but it worked fine up to and including php-4.2.2.
> 
> This system is used by over 100,000 customers, so it's not something
> we're about to scrap ;)
> 
> However, it does appear that we're going to have to make some
> fundamental changes in the XML parsing.
> 
> I originally reported this as a PHP bug, but further investigating
> revealed that the real issue was with our use of xml_parse.
> 
> -Derek





More information about the Expat-discuss mailing list