Hi,
My experience is that you need to set the NamespaceContext on the XPath so
that you can map a prefix to the namespace URI. See:
http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/xpath/XPath.html#setNamespaceContext(javax.xml.namespace.NamespaceContext).
For example, you can associate "sca" or "s" (maybe even an empty one) with
the SCA namespace. Then you can use the prefix with the XPath expression,
such as s:composite or sca:composite.
Thanks,
Raymond
----- Original Message -----
From: "Venkata Krishnan" <[EMAIL PROTECTED]>
To: "tuscany-dev" <tuscany-dev@ws.apache.org>
Sent: Friday, February 08, 2008 4:22 AM
Subject: XPath related question
Hi,
I am trying to get some xpaths evaluated against a composite file. I have
a
couple of questions related to xpath queries. Can somebody familiar
please
help. Thanks.
My composite element in the composite file defines the defaultnamespace -
xmlns="http://www.osoa.org/xmlns/sca/1.0". Given this if I construct a
xpath that is like "/composite" or "/composite/component" the query does
not
return any result.
On the other hand if I added the following namespace declaration to the
composite element "xmlns*:sca*="http://www.osoa.org/xmlns/sca/1.0" and
then
constructed an xpath - "/sca:composite" or "/sca:composite/sca:component",
then the query returns the expected results. Any clues to what I am
missing
out here ?
The other question I have is, to an xpath - "/sca:composite/sca:component"
I
expect the set of all component nodes to be returned, but instead I seem
to
be getting just the first one. How do I get the set of all component
nodes
?
Thanks
- Venkat
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]