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 Dan Alford <da...@appraisalforum.com> on 2004/02/03 21:17:22 UTC
Problem selecting attribute
Hi All,
Im trying to evaluate Xindice for an upcoming project but I have ran
into a problem. I cant seem to select an individual attribute.
Using the following XML as an example
<?xml version="1.0" encoding="UTF-8"?>
<test>
<data>
<line number="1">
<somedata>data</somedata>
</line>
<line number="2">
<somedata>data</somedata>
</line>
</data>
</test>
If I run the following:
xindice xpath -c /db/test -q //*[@number]
I get back both elements.
<?xml version="1.0"?>
<line number="1" xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/test" src:key="test">
<somedata>data</somedata>
</line>
<?xml version="1.0"?>
<line number="2" xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/test" src:key="test">
<somedata>data</somedata>
</line>
If I try to select a single element by its attribute value, using
xindice xpath -c /db/test -q //*[@number="1"]
xindice appears to run ok ( no error messages) but I get no output.
I have tried enclosing the attribute with single quotes and no quotes
and still get the same result.
Running the XPath in XML Spy against the xml will return the single
match, so im not sure what im doing wrong.
I am using :
Xindice 1.0 (Birthday)
j2sdk1.4.2_01
Windows 2000
Regards,
Dan Alford
Re: Problem selecting attribute
Posted by Dan Alford <da...@appraisalforum.com>.
Vadim,
I had two main problems, the first being the connection port problem
and the second being the selecting on an attribute. The connection port
problem was well documented (there is allready a wiki entry). The
selecting on an attribute problem I learned was due to problems with
using an XPath query on a windows 2000 command line. I found a solution
in the archives, that said you need to put double quotes around the
entry. I did it and it worked. I added a wiki entry to detail the
problem and the solution, so hopefully I can help someone else with the
problem.
Im very impressed with Xindice, we will be looking at using it in a new
project to store XML reports.
Vadim Gritsenko wrote:
> Dan Alford wrote:
>
>> Vadim,
>> I downloaded 1.1 and had the same problem (as well as a couple of
>> new ones).
>
>
>
> How this can be reproduced? Send specific steps, I'll try them some
> time later...
>
>
>> I managed to resolve them by finding information within the mailing
>> archives. I noticed they were not in the FAQ. Do you want me to do a
>> brief write up of the problems and solutions for the FAQ?
>
>
>
> You can use new Wiki to add FAQs in there.
>
> Vadim
>
>
>
Re: Problem selecting attribute
Posted by Vadim Gritsenko <va...@reverycodes.com>.
Dan Alford wrote:
> Vadim,
> I downloaded 1.1 and had the same problem (as well as a couple of
> new ones).
How this can be reproduced? Send specific steps, I'll try them some time
later...
> I managed to resolve them by finding information within the mailing
> archives. I noticed they were not in the FAQ. Do you want me to do a
> brief write up of the problems and solutions for the FAQ?
You can use new Wiki to add FAQs in there.
Vadim
Re: Problem selecting attribute
Posted by Dan Alford <da...@appraisalforum.com>.
Vadim,
I downloaded 1.1 and had the same problem ( as well as a couple of
new ones). I managed to resolve them by finding information within the
mailing archives. I noticed they were not in the FAQ. Do you want me to
do a brief write up of the problems and solutions for the FAQ?
Dan
Vadim Gritsenko wrote:
> Dan Alford wrote:
>
>> Vadim,
>> I made a mistake in my first post. Rather than selecting an
>> attribute, I want to select on an attribute, so I can find some xml
>> node with the required attribute and value.
>
>
>
> Ah, ok, than I can tell you that this works Ok (at least in 1.1)
>
>
>> I only downloaded 1.0 as it was labelled stable on the apache site. I
>> tend to avoid trying beta software when assessing a product for a
>> project. If 1.1 is stable (ish) I will download it.
>
>
>
> 1.1 is in development for a long time now. 1.1 is very different in
> deployment and uses different wire protocol. It is stable in most parts.
>
> Vadim
Re: Problem selecting attribute
Posted by Vadim Gritsenko <va...@reverycodes.com>.
Dan Alford wrote:
> Vadim,
> I made a mistake in my first post. Rather than selecting an
> attribute, I want to select on an attribute, so I can find some xml
> node with the required attribute and value.
Ah, ok, than I can tell you that this works Ok (at least in 1.1)
> I only downloaded 1.0 as it was labelled stable on the apache site. I
> tend to avoid trying beta software when assessing a product for a
> project. If 1.1 is stable (ish) I will download it.
1.1 is in development for a long time now. 1.1 is very different in
deployment and uses different wire protocol. It is stable in most parts.
Vadim
Re: Problem selecting attribute
Posted by Dan Alford <da...@appraisalforum.com>.
Vadim,
I made a mistake in my first post. Rather than selecting an
attribute, I want to select on an attribute, so I can find some xml node
with the required attribute and value.
I only downloaded 1.0 as it was labelled stable on the apache site. I
tend to avoid trying beta software when assessing a product for a
project. If 1.1 is stable (ish) I will download it.
Dan
Vadim Gritsenko wrote:
> Dan Alford wrote:
>
>> Hi All,
>> Im trying to evaluate Xindice for an upcoming project but I have
>> ran into a problem. I cant seem to select an individual attribute.
>
>
>
> Are you sure that you want to select an attribute?
>
>
>> xindice xpath -c /db/test -q //*[@number]
>
>
>
> This will select elements which has attribute named 'number'
>
>
>> xindice xpath -c /db/test -q //*[@number="1"]
>
>
>
> And this also will select elements, whose 'number' attribute has value
> '1'.
>
>
>> Xindice 1.0 (Birthday)
>
>
>
> Dan, I'm not actually sure wether anybody here will be able to help
> you with 1.0. Most of the folks are moved to 1.1
> (and if there are 1.0 users here - they will correct me ;-)
>
>
> Vadim
>
>
>
--
Dan Alford
Java Developer
Appraisal Forum
6800 Poplar Avenue, Ste. 121
Memphis, TN 38138
866-367-8611 Ext.290
Direct 901-759-2475
dalford@appraisalforum.com
www.appraisalforum.com
Re: Problem selecting attribute
Posted by Vadim Gritsenko <va...@reverycodes.com>.
Dan Alford wrote:
> Hi All,
> Im trying to evaluate Xindice for an upcoming project but I have
> ran into a problem. I cant seem to select an individual attribute.
Are you sure that you want to select an attribute?
> xindice xpath -c /db/test -q //*[@number]
This will select elements which has attribute named 'number'
> xindice xpath -c /db/test -q //*[@number="1"]
And this also will select elements, whose 'number' attribute has value '1'.
> Xindice 1.0 (Birthday)
Dan, I'm not actually sure wether anybody here will be able to help you
with 1.0. Most of the folks are moved to 1.1
(and if there are 1.0 users here - they will correct me ;-)
Vadim