How does InfoPath implement XPath? - InfoPath Dev
in

InfoPath Dev

How does InfoPath implement XPath?

Last post 10-16-2013 12:59 PM by Shrout1. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-03-2013 06:31 AM

    How does InfoPath implement XPath?

    InfoPath's use of Xpath expressions as default values in the data source (I.E. the context node) tends to baffle users on StackOverflow. I am often told, "XPath doesn't actually change anything"; this true as XSLT is used for XML transformations. When I state that the XPath expression is housed *inside* of a particular node, that tends to confuse users on Stack. I realize that the XPath expression isn't actually *housed* in the node, but instead it dictates the value that is placed into that node. Also, setting the default value of a particular field in the data source (or really the default value of a node) means that the XPath executes while using that particular node as the context node. In every XPath tester I find online I cannot simulate this behavior. I assume that these behaviors occur due to the nature of the InfoPath template components in conjunction with the source XML. An XSN template file is really just a CAB file with many different components in it. Can anyone direct me to some specific resources or provide additional clarity about the specific behaviors of XPath inside of an InfoPath template?

    Filed under: ,
  • 07-08-2013 11:09 AM In reply to

    Re: How does InfoPath implement XPath?

    I'm having a bit of trouble understanding what it is exactly that you're trying to figure out. Perhaps saying that the XPath is *housed* inside a node isn't really the right way to look at it. InfoPath allows you to specify an XPath expression as the expression to determine the default value of a field, and the InfoPath mechanism does the work of setting the field to the result of these expressions. The current() function is not an InfoPath invention. It is part of the XSLT standard, though it is not included in XPath standard.

    If you could provide a bit of a more specific question about what it is that you'd like to know, that would probably help provide you with a more informative answer.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-09-2013 06:49 AM In reply to

    Re: How does InfoPath implement XPath?

    Jimmy,

    Thanks for responding! This is more of a discussion question as I am trying to better understand how InfoPath uses XPath. Take a look at this StackOverflow question about "current" vs. "context" node. When referring to the "current" node, I don't actually mean the "current()" function but actually the node that is being evaluated at that time... My lack of understanding could be creating a communication gap here as I may be misusing terminology.

     

    It seems to me that XPath expressions are not actually contained in the XML itself... It seems that they are executed against the XML structure in much the same way that an SQL query is executed against a database. I run my SQL query and reference tables and columns to return a specifc value; I then must explicitly store that value somewhere. In InfoPath I use an XPath expression to reference a particular node and return a particular value. It seems that InfoPath provides the means of storing that value in a node, and typically XPath doesn't do that on its own...

     

     My mental model may be out of whack though, as XPath and SQL are very different creatures...

     

    Any insight into how InfoPath uses XPath at a fundamental level would be greatly appreciated!

  • 10-16-2013 12:59 PM In reply to

    Re: How does InfoPath implement XPath?

    A simple example of this conundrum is as follows:

    When entering a default value into a data field one can enter "../my:value1" - the relative location of that value to the current field. When entering this same field into a filter the field is specified as such "xdXDocument:get-DOM()/my:myFields/my:MasterSection/my:value1". There is no relative path to the field. Clearly this touches on the way that InfoPath handles XPath.

     It almost seems like InfoPath appends "current()../" in front of every default value. That might be incorrect on my behalf....

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.