|
See my previous post (7/21) for an example provided by Tony
Dean with namespaces in XPaths. Here is the relevant code:
> Sring ns = "declare namespace ns='http://tempuri.org/myService';"; > String xpath = ns + > "$this/ns:copyintoout/ns:[EMAIL PROTECTED]'Tony']"; > XmlObject[] selections = soapBody.selectPath(xpath); There
is nothing for that in XmlOptions because there is a "semi-standard" way of
doing it by using 'declare namespace pipeline="http://nrg.wustl.edu/pipeline"'
and we stick to that.
Hope
this helps,
Radu
From: Mohana Ramaratnam [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 18, 2006 8:06 AM To: [email protected] Subject: XPath and Namespace If I have an instance document like
so: <Pipeline
xmlns="http://nrg.wustl.edu/pipeline"
xmlns:prov="http://www.nbirn.net/prov"
xmlns:xdat="http://nrg.wustl.edu/xdat"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://nrg.wustl.edu/xnat C:\\schema\pipeline.xsd"> <parameters>
<parameter>
<name>fidldir</name>
<value>/fidl/fidl_2.60/bin</value>
</parameter>
<parameter>
<name>rlbdir</name>
<value>/Pipeline/parameters/parameter[name='fidldir']/value/text()
</value>
</parameter> </parameters> </Pipeline> And I want to evaluate the xpath
_expression_: /Pipeline/parameters/parameter[name='fidldir']/value/text() Is it necessary for the namespace
prefix of pipeline: to be present in the _expression_ /Pipeline/parameters/parameter[name='fidldir']/value/text() for xpath to be
evaluated correctly? Ie should the
_expression_ be: /pipeline:Pipeline/pipeline:parameters/pipeline:parameter[pipeline:name='fidldir']/pipeline:value/text()
(as in the
samples) How do I set the
namespace so that the instance document xpath _expression_ need not have the
namespace prefixed. I have looked into XmlOptions and didn’t find anything
useful. _______________________________________________________________________ Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. |
- XPath and Namespace Mohana Ramaratnam
- RE: XPath and Namespace Radu Preotiuc-Pietro

