Problem with XPath query

Given the following XML:

<Pages>
<Page>
<DisplayRef alias="Widget">
<parameter alias="widgetType" type="variable" value="system"/>
</DisplayRef>
</Page>
</Pages>

I'm using the following query:

$oXPath->query( '//DisplayRef/parameter[ [at] alias="widgetType and
[at] value="system"]' );

and I'm getting the following error:

Warning: DOMXPath::query() [function.DOMXPath-query]: Invalid predicate

If I remove this part of the query

[ [at] alias="widgetType and [at] value="system"]

the error goes away.

As far as I can tell from googling around, the query is valid. If
that's the case, I don't understand what's causing the error.
Could someone explain to me what I'm doing wrong?

thnx,
Christoph

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Christoph Boget [ Mo, 14 Dezember 2009 17:52 ] [ ID #2025918 ]

Re: Problem with XPath query

Hi,

You are missing a quote after widgetType:

[ [at] alias=3D"widgetType and [at] value=3D"system"]

should be

[ [at] alias=3D"widgetType" and [at] value=3D"system"]

Regards,

Jonathan

On Mon, Dec 14, 2009 at 1:52 PM, Christoph Boget
<christoph.boget [at] gmail.com> wrote:
> Given the following XML:
>
> <Pages>
> =A0<Page>
> =A0 =A0<DisplayRef alias=3D"Widget">
> =A0 =A0 =A0<parameter alias=3D"widgetType" type=3D"variable" value=3D"sys=
tem"/>
> =A0 =A0</DisplayRef>
> =A0</Page>
> </Pages>
>
> I'm using the following query:
>
> $oXPath->query( '//DisplayRef/parameter[ [at] alias=3D"widgetType and
> [at] value=3D"system"]' );
>
> and I'm getting the following error:
>
> Warning: DOMXPath::query() [function.DOMXPath-query]: Invalid predicate
>
> If I remove this part of the query
>
> [ [at] alias=3D"widgetType and [at] value=3D"system"]
>
> the error goes away.
>
> As far as I can tell from googling around, the query is valid. =A0If
> that's the case, I don't understand what's causing the error.
> Could someone explain to me what I'm doing wrong?
>
> thnx,
> Christoph
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jonathan Tapicer [ Mo, 14 Dezember 2009 18:25 ] [ ID #2025919 ]

Re: Problem with XPath query

> You are missing a quote after widgetType:

Yeah, I realized that about 2 minutes after I sent the message. Man,
I'm dumb. :p I was banging my head against the wall for a while
because of that. I guess when you bring your stupidity public, you'll
find the solution yourself that much quicker. ;)

thnx,
Christoph

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Christoph Boget [ Mo, 14 Dezember 2009 18:31 ] [ ID #2025920 ]

Re: Problem with XPath query

Christoph Boget wrote:
>> You are missing a quote after widgetType:
>
> Yeah, I realized that about 2 minutes after I sent the message. Man,
> I'm dumb. :p I was banging my head against the wall for a while
> because of that. I guess when you bring your stupidity public, you'll
> find the solution yourself that much quicker. ;)

I often find that it's quicker to ask - because invariably the answer presents
itself the second you hit send ;)

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Lester Caine [ Mo, 14 Dezember 2009 18:48 ] [ ID #2025921 ]

Re: Problem with XPath query

Lester Caine wrote:
>
> I often find that it's quicker to ask - because invariably the answer
> presents itself the second you hit send ;)
>

Isn't that the truth!

Jim

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
List Manager [ Mo, 14 Dezember 2009 18:59 ] [ ID #2025922 ]
PHP » gmane.comp.php.general » Problem with XPath query

Vorheriges Thema: ErrorException and set_exception_handler()
Nächstes Thema: Strange MySQL Problem