Context Node in XPath 1.0

Discussion in 'XML' started by Tim Hallwyl, Nov 11, 2007.

  1. Tim Hallwyl

    Tim Hallwyl Guest

    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.
    Tim Hallwyl, Nov 11, 2007
    #1
    1. Advertising

  2. 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)

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Nov 11, 2007
    #2
    1. Advertising

  3. Tim Hallwyl

    Tim Hallwyl Guest

    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...

    > >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?


    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.
    Tim Hallwyl, Nov 12, 2007
    #3
  4. 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.


    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Nov 13, 2007
    #4
  5. Tim Hallwyl

    Tim Hallwyl Guest

    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.
    Tim Hallwyl, Nov 15, 2007
    #5
  6. Tim Hallwyl wrote:
    > 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.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Nov 15, 2007
    #6
  7. Tim Hallwyl

    Tim Hallwyl Guest

    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.
    Tim Hallwyl, Nov 15, 2007
    #7
  8. Tim Hallwyl

    Tim Hallwyl Guest

    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.
    Tim Hallwyl, Nov 15, 2007
    #8
  9. Tim Hallwyl wrote:
    > 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...




    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
    Joseph Kesselman, Nov 15, 2007
    #9
  10. Tim Hallwyl

    Tim Hallwyl Guest

    Joseph Kesselman skrev:

    > 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...


    I have moved the discussion to the newly created WS-BPEL forum at:

    http://bpel.xml.org/how-can-context-node-point-xpath-object

    Thank you for your input so far. You are more than welcome to join the
    discussions at http://bpel.xml.org

    --tim
    Tim Hallwyl, Nov 25, 2007
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,414
  2. VS_NET_DEV
    Replies:
    2
    Views:
    3,790
    jenny
    May 25, 2004
  3. Alastair Cameron
    Replies:
    1
    Views:
    7,370
    SQL Server Development Team [MSFT]
    Jul 8, 2003
  4. Tjerk Wolterink
    Replies:
    2
    Views:
    1,406
    Dimitre Novatchev
    Aug 24, 2006
  5. Thomas Schmidt

    XPath - context node evaluation problem

    Thomas Schmidt, Jan 9, 2007, in forum: XML
    Replies:
    4
    Views:
    608
    David Carlisle
    Jan 10, 2007
Loading...

Share This Page