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 miten mehta <im...@yahoo.com> on 2002/06/27 20:02:37 UTC

query

Hello,

I am trying to understand how to query xindice with
xpath correctly.  

I have with jaxr submitted data into xindice.

I am able to retrieve it using its key and xindice and
also using query as //xnode:Body as snippet below.

Body I suppose has wsdl related stuff. can I query on
wsdl stuff elements like here is its snippet and I
would like to query on personName.  I tried but does
not return any data.  

<?xml version="1.0"?><xnode:Body
xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/uddi"
src:key="ee83d361-51ee-83d3-6a1d-83c7f78cb5ae"
xmlns:xnode="http://www.apache.org/xnode/1.0/"><businessEntity
authorizedName="testuser"
businessKey="ee83d361-51ee-83d3-6a1d-83c7f78cb5ae"
operator="Sun Microsystems Inc."
xmlns="urn:uddi-org:api_v2"><discoveryURLs><discoveryURL
useType="getUrl">http://localhost:8080/registry-server/businessEntity?businessKey=ee83d361-51ee-83d3-6a1d-83c7f78cb5ae</discoveryURL></discoveryURLs><name
xml:lang="en">Miten Software</name><description
xml:lang="en">Software
People</description><contacts><contact><description
xml:lang="en" /><personName>Miten
Mehta</personName><phone useType="">630 540
2307</phone><email>imiten@yahoo.com</email></contact></contacts><businessServices><businessService
businessKey="ee83d361-51ee-83d3-6a1d-83c7f78cb5ae"
serviceKey="ee83d361-51ee-83d3-c9bc-bac2adc271b"><name
xml:lang="en" /><description xml:lang="en">Address
Table Row
count</description><bindingTemplates><bindingTemplate
bindingKey="ee83d361-51ee-83d3-beb9-e1e20bbcf89f"
serviceKey="ee83d361-51ee-83d3-c9bc-5bac2adc271b"><description
xml:lang="en">Get Row Count of
tblAddress</description><accessPoint
URLType="http">http://localhost:9080/dataentry/address/AddressIF</accessPoint><tModelInstanceDetails
/></bindingTemplate></bindingTemplates><categoryBag
/></businessService></businessServices><identifierBag
/><categoryBag><keyedReference keyName="Java Software"
keyValue="007"
tModelKey="uuid:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2"
/></categoryBag></businessEntity></xnode:Body>




__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

Re: query

Posted by miten mehta <im...@yahoo.com>.
uddi namespace does not do trick.  

--- Vanessa Williams <v....@acm.org> wrote:
> miten mehta wrote:
> 
> > Hello,
> > 
> > I am trying to fetch xnode:Body nodes which have
> > personName as Miten Mehta.  Actually document has
> > xnode:Envelope as docelement.   I tried various
> xpaths
> > in api but with no match.  Only thing that works
> is
> > /xnode:Envelope/xnode:Body or //xnode:Body.  Body
> > content is not taking part in xpath match it
> seems.
> > 
> > I am trying to figure out does body content take
> part
> > in xpath query for soap message documents.
> 
> The default namespace declaration on the
> businessentity element may be a
> source of trouble. As an experiment, you could give
> the uddi namespace a
> prefix (say, "uddi"). Make sure to set the xnode and
> uddi namespaces for the
> XPathQueryService. Then try the query as:
> 
>
/xnode:envelope/xnode:body[uddi:businessentity/uddi:contacts/uddi:contact/ud
> di:personname = "Miten Mehta"]
> 
> Unfortunately, I don't know how to set a namespace
> as the default (having no
> prefix) within the XPathQueryService. In any event,
> it doesn't *become* the
> default namespace until later in the document which
> makes it even more
> confusing, since you have to set all the namespaces
> up front before doing
> the query. XPath is just sort of broken when it
> comes to namespaces, IMHO.
> 
> It's best to avoid the use of //xnode:body[...],
> because its performance is
> very poor.
> 
> Good luck,
> 
> Vanessa
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

Re: query

Posted by Vanessa Williams <v....@acm.org>.
miten mehta wrote:

> Hello,
> 
> I am trying to fetch xnode:Body nodes which have
> personName as Miten Mehta.  Actually document has
> xnode:Envelope as docelement.   I tried various xpaths
> in api but with no match.  Only thing that works is
> /xnode:Envelope/xnode:Body or //xnode:Body.  Body
> content is not taking part in xpath match it seems.
> 
> I am trying to figure out does body content take part
> in xpath query for soap message documents.

The default namespace declaration on the businessentity element may be a
source of trouble. As an experiment, you could give the uddi namespace a
prefix (say, "uddi"). Make sure to set the xnode and uddi namespaces for the
XPathQueryService. Then try the query as:

/xnode:envelope/xnode:body[uddi:businessentity/uddi:contacts/uddi:contact/ud
di:personname = "Miten Mehta"]

Unfortunately, I don't know how to set a namespace as the default (having no
prefix) within the XPathQueryService. In any event, it doesn't *become* the
default namespace until later in the document which makes it even more
confusing, since you have to set all the namespaces up front before doing
the query. XPath is just sort of broken when it comes to namespaces, IMHO.

It's best to avoid the use of //xnode:body[...], because its performance is
very poor.

Good luck,

Vanessa


Re: query

Posted by miten mehta <im...@yahoo.com>.
Hello,

I am trying to fetch xnode:Body nodes which have
personName as Miten Mehta.  Actually document has
xnode:Envelope as docelement.   I tried various xpaths
in api but with no match.  Only thing that works is
/xnode:Envelope/xnode:Body or //xnode:Body.  Body
content is not taking part in xpath match it seems.

I am trying to figure out does body content take part
in xpath query for soap message documents.


--- Vanessa Williams <v....@acm.org> wrote:
> I'm not sure what you're trying to do, but...
> 
> If you want to return all the personname elements,
> try this:
> 
>
/xnode:body/businessentity/contacts/contact/personname
> 
> If you want to return all the xnode:body elements in
> which personname =
> "Miten Mehta", try this:
> 
>
/xnode:body[businessentity/contacts/contact/personname
> = "Miten Mehta"]
> 
> If you're using the command-line tool, the namespace
> prefixes may cause you
> grief. See yesterday's discussion for workarounds.
> 
> 
> Vanessa
> 
> miten mehta wrote:
> 
> > Hello,
> > 
> > I am trying to understand how to query xindice
> with
> > xpath correctly. 
> > 
> > I have with jaxr submitted data into xindice.
> > 
> > I am able to retrieve it using its key and xindice
> and
> > also using query as //xnode:Body as snippet below.
> > 
> > Body I suppose has wsdl related stuff. can I query
> on
> > wsdl stuff elements like here is its snippet and I
> > would like to query on personName.  I tried but
> does
> > not return any data.
> > 
> > <?xml version="1.0"?><xnode:Body
> > xmlns:src="http://xml.apache.org/xindice/Query"
> > src:col="/db/uddi"
> > src:key="ee83d361-51ee-83d3-6a1d-83c7f78cb5ae"
> >
>
xmlns:xnode="http://www.apache.org/xnode/1.0/"><businessEntity
> > authorizedName="testuser"
> > businessKey="ee83d361-51ee-83d3-6a1d-83c7f78cb5ae"
> > operator="Sun Microsystems Inc."
> >
>
xmlns="urn:uddi-org:api_v2"><discoveryURLs><discoveryURL
> >
>
useType="getUrl">http://localhost:8080/registry-server/businessEntity?business
> >
>
Key=ee83d361-51ee-83d3-6a1d-83c7f78cb5ae</discoveryURL></discoveryURLs><name
> > xml:lang="en">Miten Software</name><description
> > xml:lang="en">Software
> >
> People</description><contacts><contact><description
> > xml:lang="en" /><personName>Miten
> > Mehta</personName><phone useType="">630 540
> >
>
2307</phone><email>imiten@yahoo.com</email></contact></contacts><businessServi
> > ces><businessService
> > businessKey="ee83d361-51ee-83d3-6a1d-83c7f78cb5ae"
> >
>
serviceKey="ee83d361-51ee-83d3-c9bc-bac2adc271b"><name
> > xml:lang="en" /><description xml:lang="en">Address
> > Table Row
> >
>
count</description><bindingTemplates><bindingTemplate
> > bindingKey="ee83d361-51ee-83d3-beb9-e1e20bbcf89f"
> >
>
serviceKey="ee83d361-51ee-83d3-c9bc-5bac2adc271b"><description
> > xml:lang="en">Get Row Count of
> > tblAddress</description><accessPoint
> >
>
URLType="http">http://localhost:9080/dataentry/address/AddressIF</accessPoint>
> > <tModelInstanceDetails
> >
> /></bindingTemplate></bindingTemplates><categoryBag
> >
>
/></businessService></businessServices><identifierBag
> > /><categoryBag><keyedReference keyName="Java
> Software"
> > keyValue="007"
> >
>
tModelKey="uuid:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2"
> > /></categoryBag></businessEntity></xnode:Body>
> > 
> > 
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! - Official partner of 2002 FIFA World Cup
> > http://fifaworldcup.yahoo.com
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

Re: query

Posted by Vanessa Williams <v....@acm.org>.
I'm not sure what you're trying to do, but...

If you want to return all the personname elements, try this:

/xnode:body/businessentity/contacts/contact/personname

If you want to return all the xnode:body elements in which personname =
"Miten Mehta", try this:

/xnode:body[businessentity/contacts/contact/personname = "Miten Mehta"]

If you're using the command-line tool, the namespace prefixes may cause you
grief. See yesterday's discussion for workarounds.


Vanessa

miten mehta wrote:

> Hello,
> 
> I am trying to understand how to query xindice with
> xpath correctly. 
> 
> I have with jaxr submitted data into xindice.
> 
> I am able to retrieve it using its key and xindice and
> also using query as //xnode:Body as snippet below.
> 
> Body I suppose has wsdl related stuff. can I query on
> wsdl stuff elements like here is its snippet and I
> would like to query on personName.  I tried but does
> not return any data.
> 
> <?xml version="1.0"?><xnode:Body
> xmlns:src="http://xml.apache.org/xindice/Query"
> src:col="/db/uddi"
> src:key="ee83d361-51ee-83d3-6a1d-83c7f78cb5ae"
> xmlns:xnode="http://www.apache.org/xnode/1.0/"><businessEntity
> authorizedName="testuser"
> businessKey="ee83d361-51ee-83d3-6a1d-83c7f78cb5ae"
> operator="Sun Microsystems Inc."
> xmlns="urn:uddi-org:api_v2"><discoveryURLs><discoveryURL
> useType="getUrl">http://localhost:8080/registry-server/businessEntity?business
> Key=ee83d361-51ee-83d3-6a1d-83c7f78cb5ae</discoveryURL></discoveryURLs><name
> xml:lang="en">Miten Software</name><description
> xml:lang="en">Software
> People</description><contacts><contact><description
> xml:lang="en" /><personName>Miten
> Mehta</personName><phone useType="">630 540
> 2307</phone><email>imiten@yahoo.com</email></contact></contacts><businessServi
> ces><businessService
> businessKey="ee83d361-51ee-83d3-6a1d-83c7f78cb5ae"
> serviceKey="ee83d361-51ee-83d3-c9bc-bac2adc271b"><name
> xml:lang="en" /><description xml:lang="en">Address
> Table Row
> count</description><bindingTemplates><bindingTemplate
> bindingKey="ee83d361-51ee-83d3-beb9-e1e20bbcf89f"
> serviceKey="ee83d361-51ee-83d3-c9bc-5bac2adc271b"><description
> xml:lang="en">Get Row Count of
> tblAddress</description><accessPoint
> URLType="http">http://localhost:9080/dataentry/address/AddressIF</accessPoint>
> <tModelInstanceDetails
> /></bindingTemplate></bindingTemplates><categoryBag
> /></businessService></businessServices><identifierBag
> /><categoryBag><keyedReference keyName="Java Software"
> keyValue="007"
> tModelKey="uuid:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2"
> /></categoryBag></businessEntity></xnode:Body>
> 
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com