Re: idw - continued
Brought to you by:
bs_php,
nigelswinson
From: Nigel S. <nig...@us...> - 2002-01-18 00:02:51
|
(I know this thread is kinda old, but it's been in my inbox all month...) > can't say I've been inundated with solutions to my previous posting :-(, but > it's actually easy to fix w/o recompiling PHP as Dan suggests. Just escape > the underscores in eregs, i.e. on lines 1990 and 2778. That's cos you ask hard questions :o) > Having fixed that, I now have a different problem. > > I have an xml file with large numbers of child (+ grandchild ...) nodes which > may or may not be present. My old phpxml script did an evaluate for the top > level and then get_Contents for any children it needed; if a child didn't > exist, phpxml simply set the variable to null. phpxpath, however, seems to > throw an error and refuse to continue if you try and getData or getDataParts > for a child or attribute that doesn't exist. If I have to do a match/evaluate > for each of these nodes before getData, not only is that a lot of extra work > but I'll probably have to rewrite the logic. > > Can phpxpath be changed to be like phpxml and simply set the variable to null > if getData doesn't find the node? A good point. Sounds annoying. :o( I think the plan is to support different levels of error reporting, so when you build the class, you set an option to say what kind of errors you want. So what you'd do then is say that you don't want errors if the node doesn't exist and you'd be happy, and if you want it to complain, you can leave the errors on. So yeah, we are aiming for this too :o) Nigel =========================== For the most recent version of Php.XPath, and an archive of this list visit: http://www.sourceforge.net/projects/phpxpath |