Re: [PHP] extending Xpath
[email protected] (Jim Lucas)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
Andrew Mason wrote:
> Hi,
> I was wondering if it was possible to extend the DOMXpath object in a
> similar fashion to the DomDocument.
>
> I was hoping to write a wrapper to provide an interface similar to
> prepared statements in the db libraries for the xpath processor.
>
>
> $xpath = new myxpath();
>
> $stmt = $xpath->prepare("/foo/bar[@foo = '?' ]");
> $stmt->bindParam( '?', $potentiallynastystring );
> $x = $stmt->execute();
>
> I have tried :
>
> final class timber_utils_domxpath extends DomXpath
> {
> public function __construct( DOMDocument $dom )
> {
> echo "in here";
> parent::_construct( $dom );
> }
> }
>
>
> but I get the following error
> Fatal error: Call to undefined method DOMXPath::_construct()
Your missing an underscore. It needs two not one.
>
> Many thanks
> Andrew
>
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare