Context Node in XPath 1.0

T

Tim Hallwyl

Hi, there!

As I understand the XPaht recommendation, the context node is a node;
not a node-list, not XPath object -- but a single node.

Now, the WS-BPEL 2.0 specification allows an XML simple type value to be
the context of an XPath expression, by converting it to an XPath object
-- either boolean, string or float.

I do not see how this is possible, but I would like your thoughts on it.

A note, that might help: In the WS-BPEL specification the phrase is "the
context node MUST point to the XPath object" -- the "point to" makes it
sound like some kind of reference.

Thanks.
 
J

Joe Kesselman

Since your question is really about how WS-BPEL is using XPath, you
might want to direct this question straight to that working group's
public comments list.
>Now, the WS-BPEL 2.0 specification allows an XML simple type value to
>be the context of an XPath expression

Could you indicate where you think you're seeing this?

Section 8.2.3 says that an XPath context consists of five basic items --
context node, context position and size, variable bindings, function
library, and namespaces in scope for the expression. Later sections go
on to explain how these are set up before the XPath runs. That's exactly
what I would have expected...

(I assume that the current copy is indeed the one posted at
http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.html#_Toc164738496)
 
T

Tim Hallwyl

Joe Kesselman skrev:
Since your question is really about how WS-BPEL is using XPath, you
might want to direct this question straight to that working group's
public comments list.

That list is dead quiet -- besides my own post, nothing had happened
since January. This is why it tried to make it about XPath...
Could you indicate where you think you're seeing this?

In section 8.2.6:
"The context node is determined as follows: ... If the type is a simple
type, the context node MUST point to the XPath object specified in
section 8.2.2"

In section 8.2.2:
"WS-BPEL simple type variables MUST be manifested directly as either an
XPath string, Boolean or float object."
Section 8.2.3 says that an XPath context consists of five basic items --
context node, context position and size, variable bindings, function
library, and namespaces in scope for the expression. Later sections go
on to explain how these are set up before the XPath runs. That's exactly
what I would have expected...

Yes, the five basic items are listed exactly as in the XPath
recommendation. However, as I read the above quoted, the context node
must point to either a XPath string, Boolean or float object. Is this
possible; how do you create a node pointing to an XPath object?
(I assume that the current copy is indeed the one posted at
http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.html#_Toc164738496)

Indeed. Thanks.
 
J

Joe Kesselman

I need to look at this in more detail, but I think you're confusing the
context node with the type of the node's contents. A node can't "be" a
simple type, but its content can.
 
T

Tim Hallwyl

Joe Kesselman skrev:
I need to look at this in more detail, but I think you're confusing the
context node with the type of the node's contents. A node can't "be" a
simple type, but its content can.

Yes, I can pass a TextNode holding the simple type content, but how do I
declare it to be either string, boolean or float?

For example. passing a TextNode, holding the string "false", to the
expression "boolean(self::node())", will return true, because it is a
string, not a boolean: a string is true if and only if its length is
non-zero.

Your opinion is much appreciated. Thanks.
 
J

Joe Kesselman

Tim said:
Yes, I can pass a TextNode holding the simple type content, but how do I
declare it to be either string, boolean or float?

To _declare_ it as such, you say so in the schema and validate against
the schema so that information is in the Post-Schema-Validation Infoset.

To _retrieve_ it as such, you may have to explicitly use the appropriate
method in your XPath API (which I believe is out of the scope of the
XPath Specification; check the documentation for your particular
implementation).

I believe XPath 2.0 and XQuery have syntax that allows the expression to
say what type the value is expected to be.
 
T

Tim Hallwyl

Joe Kesselman skrev:
Tim Hallwyl wrote:
To _declare_ it as such, you say so in the schema and validate against
the schema so that information is in the Post-Schema-Validation Infoset.

I admit that I have not tried using a PSVI, but I do not believe this
helps. As I understand it, XPath 1.0 does not support XML Schema at all
-- thus, any content of a TextNode, regardless of its intended type, is
always an XPath String object -- also when passed as the context node.

Am I wrong?
To _retrieve_ it as such, you may have to explicitly use the appropriate
method in your XPath API [...]

I have no problems retrieving typed values, corresponding the XPath 1.0
objects.
I believe XPath 2.0 and XQuery have syntax that allows the expression to
say what type the value is expected to be.

Yes, I believe so too. However, the WS-BPEL specification, section
2.8.6, says: "When XPath 1.0 is used as Query Language [...]"

So, to summarize: The WS-BPEL specification requires in some cases, that
the context node must point to an XPath object. The question is, how
is this possible, using XPath 1.0?

Thanks.
 
T

Tim Hallwyl

Tim Hallwyl skrev:
I admit that I have not tried using a PSVI

Now I have tried it, with a small set-up in Java. I verified that the
node passed as context node was a boolean using the Xerces
PSVIDocumentImpl. As I expected it did not change anything.

I am somewhat convinced that XPath 1.0 does not support XML Schema and
all node values are string objects in XPath. If so, what could they
mean, when writing that the context node must point to an XPath object,
such as boolean, float or string?

Any thoughts are welcome. Thanks.
 
J

Joseph Kesselman

Tim said:
I am somewhat convinced that XPath 1.0 does not support XML Schema and
all node values are string objects in XPath.

Actually, I think that is true in 1.0.
> If so, what could they
mean, when writing that the context node must point to an XPath object,
such as boolean, float or string?

I'm still not convinced they intended to say that. At this point I
really would suggest trying to bounce this back to the working group, or
picking out one of the authors and pestering them...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top