Re: SimpleXML XPath Namespace Support

From: Date: Sat, 22 Nov 2003 22:43:34 +0000
Subject: Re: SimpleXML XPath Namespace Support
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-5670@lists.php.net to get a copy of this message
From: Adam Maccabee Trachtenberg > That's why I create a new xmlXPathNewContext inside simplexml_ce_register_ns. > > + if (!sxe->xpath) { > + sxe->xpath = xmlXPathNewContext((xmlDocPtr) sxe->document->ptr); > + } 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 (by registered namespaces I refer to ones the user adds via the register_ns call) and depending upon which object is used to search with (it may even be one which wasnt used with a register_ns call), would then determe which ones are used. I am not sure if this is the correct behavior as it seems that all the namesapces from nsmap should be used for the query. Rob

« previous php.internals (#5670) next »