Re: SimpleXML XPath Namespace Support
| From: | Adam Maccabee Trachtenberg | Date: | Sun, 23 Nov 2003 08:44:26 +0000 |
| Subject: | Re: SimpleXML XPath Namespace Support | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-5674@lists.php.net to get a copy of this message | ||
On Sat, 22 Nov 2003, Rob Richards wrote:
> But xpath isn't shared across the objects, so calling
> simplexml_ce_register_ns with different sxe objects will result in
> multiple XPath contexts each having their own registered namespaces
Ah. I see. Okay, I've prepared a modified patch that defers namespace
registration until the call to simplexml_ce_xpath_search(). Inside
that function, I iterate through the nsmapptr->nsmap hash and register
all the namespaces.
Since nsmapptr is shared across the objects this should be okay,
right?
Check out:
http://www.trachtenberg.com/patches/simplexml_xpath_ns_patch.txt
-adam
PS: At a minimum, we should probably do some validity checks on the
prefix, so people can't register an empty or invalid prefix. I'll look
into this.
--
adam@trachtenberg.com