You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Benjamin Hood <be...@gmx.net> on 2002/02/20 21:07:22 UTC

QUERIES: NS-Attribute Predicates in the Root Node / Returning Attribute Nodes

Hi,

I am trying out Xindice rc 1.0 and have noticed that two types of XPath
Queries aren't working for me:

1. Applying Predicates to the attributes of document root nodes:

eg:    /root[@xmlns:foo]

returns nothing, whereas quering the root,

ie     /

returns the expected document

<root xmlns:foo="http://bar">
    ....other nodes
</root>

This kind of predicate works fine on nodes other than the root.

2. Returning just the value of Attribute Nodes

Using attributes as predicates works fine,

eg    //*[@type]
or    //*[@type='someType']


But trying to just return the attribute axis doesn't seem to work:

eg     //*/@type

I've also noticed that trying to return

text()
namespace()

yields nothing.

Does anybody know the trick?

Cheers

Ben


Re: QUERIES: NS-Attribute Predicates in the Root Node / Returning Attribute Nodes

Posted by Kimbro Staken <ks...@xmldatabases.org>.
On Thursday, February 21, 2002, at 11:05 AM, Benjamin Hood wrote:
>>>
>>
>> This is a known problem. You can work around it for now by retrieving the
>> node and extracting the attribute. You'll have the problem with any query
>> that returns an atomic value rather then a node of some type.
>
> Obvoiusly this would a quick solution, but I would be more interested in
> working on a more long term solution. Other than that, it's work that a
> backend should be doing. Maybe you could let me know where this has been
> implemented so that I could weigh up the option of fixing the problem on 
> the
> xindice side....
>

The problem is in the XML:DB API. It's a known problem and will be fixed 
in the next update. Don't know when that will be.

>>>
Kimbro Staken - http://www.kstaken.org - http://www.xmldatabases.org
Apache Xindice native XML database http://xml.apache.org
XML:DB Initiative http://www.xmldb.org
Senior Technologist (Your company name here)
>>
>


Re: QUERIES: NS-Attribute Predicates in the Root Node / Returning Attribute Nodes

Posted by Benjamin Hood <be...@gmx.net>.
----- Original Message -----
From: "Kimbro Staken" <ks...@xmldatabases.org>
To: <xi...@xml.apache.org>
Sent: Thursday, February 21, 2002 6:39 PM
Subject: Re: QUERIES: NS-Attribute Predicates in the Root Node / Returning
Attribute Nodes


>
> On Wednesday, February 20, 2002, at 01:07 PM, Benjamin Hood wrote:
>
> > Hi,
> >
> > I am trying out Xindice rc 1.0 and have noticed that two types of XPath
> > Queries aren't working for me:
> >
> > 1. Applying Predicates to the attributes of document root nodes:
> >
>
> Not sure about this, may be a bug.
>
> > eg:    /root[@xmlns:foo]
> >
> > returns nothing, whereas quering the root,
> >
> > ie     /
> >
> > returns the expected document
> >
> > <root xmlns:foo="http://bar">
> >     ....other nodes
> > </root>
> >
> > This kind of predicate works fine on nodes other than the root.
> >
> > 2. Returning just the value of Attribute Nodes
>
> This is a known problem. You can work around it for now by retrieving the
> node and extracting the attribute. You'll have the problem with any query
> that returns an atomic value rather then a node of some type.

Obvoiusly this would a quick solution, but I would be more interested in
working on a more long term solution. Other than that, it's work that a
backend should be doing. Maybe you could let me know where this has been
implemented so that I could weigh up the option of fixing the problem on the
xindice side....

>
> >
> > Using attributes as predicates works fine,
> >
> > eg    //*[@type]
> > or    //*[@type='someType']
> >
> >
> > But trying to just return the attribute axis doesn't seem to work:
> >
> > eg     //*/@type
> >
> > I've also noticed that trying to return
> >
> > text()
> > namespace()
> >
> > yields nothing.
> >
> > Does anybody know the trick?
> >
> > Cheers
> >
> > Ben
> >
> >
> Kimbro Staken - http://www.kstaken.org - http://www.xmldatabases.org
> Apache Xindice native XML database http://xml.apache.org
> XML:DB Initiative http://www.xmldb.org
> Senior Technologist (Your company name here)
>


Re: QUERIES: NS-Attribute Predicates in the Root Node / Returning Attribute Nodes

Posted by Kimbro Staken <ks...@xmldatabases.org>.
On Wednesday, February 20, 2002, at 01:07 PM, Benjamin Hood wrote:

> Hi,
>
> I am trying out Xindice rc 1.0 and have noticed that two types of XPath
> Queries aren't working for me:
>
> 1. Applying Predicates to the attributes of document root nodes:
>

Not sure about this, may be a bug.

> eg:    /root[@xmlns:foo]
>
> returns nothing, whereas quering the root,
>
> ie     /
>
> returns the expected document
>
> <root xmlns:foo="http://bar">
>     ....other nodes
> </root>
>
> This kind of predicate works fine on nodes other than the root.
>
> 2. Returning just the value of Attribute Nodes

This is a known problem. You can work around it for now by retrieving the 
node and extracting the attribute. You'll have the problem with any query 
that returns an atomic value rather then a node of some type.

>
> Using attributes as predicates works fine,
>
> eg    //*[@type]
> or    //*[@type='someType']
>
>
> But trying to just return the attribute axis doesn't seem to work:
>
> eg     //*/@type
>
> I've also noticed that trying to return
>
> text()
> namespace()
>
> yields nothing.
>
> Does anybody know the trick?
>
> Cheers
>
> Ben
>
>
Kimbro Staken - http://www.kstaken.org - http://www.xmldatabases.org
Apache Xindice native XML database http://xml.apache.org
XML:DB Initiative http://www.xmldb.org
Senior Technologist (Your company name here)


Re: QUERIES: NS-Attribute Predicates in the Root Node / Returning Attribute Nodes

Posted by Timo Boehme <bo...@informatik.uni-leipzig.de>.
> I am trying out Xindice rc 1.0 and have noticed that two types of XPath
> Queries aren't working for me:
> ...
>
> 2. Returning just the value of Attribute Nodes
> ...
> 
> But trying to just return the attribute axis doesn't seem to work:
> 
> eg     //*/@type

I can only answer your second question. I had the same question a couple
of weeks ago. This was the response from Kimbro Staken:

>> My question is: Is the XPath implementation of dbXML in general not
>> able to retrieve a list of attribute values so that I have to retrieve
>> the complete element containing the attribute?
 
> That's correct, you have to retrieve the entire element right now.

So far as I know it is on the TODO list...


Kind regards,
Timo