代码之家  ›  专栏  ›  技术社区  ›  StuartLC

BizTalk BAM - manually editing BTT XPath to return just the First instance of a Message Payload property?

  •  2
  • StuartLC  · 技术社区  · 15 年前

    We have a preference for using TPE for BAM tracking since it can be deployed independently of our orchestrations.

    However, at one point in our process, we need to track a message payload property which has a 1:N relationship with the Root XML Element of the message.

    与往常一样,如果我们尝试跟踪此消息,则会记录以下XLANG消息:

    AmbiguousXPathException - The result set for the XPath expression ... 
    contains more than a single node
    

    我们试图直接修改btt-xpath以仅选择此属性的第一个实例

    我试过了

    'XPath="//*[local-name()='Property' and namespace-uri()='{URI}' ...]/[1]'

    但随后得到错误“表达式必须计算为节点集”

    更简单

    '//Property[1]' and '//Property[position() = 1]'
    

    别犯错,但这也不能把我的财产拿出来。

    最后,有人能解释btt文件中xpath和somxpath之间的区别吗?

    1 回复  |  直到 10 年前
        1
  •  3
  •   Dimitre Novatchev    15 年前

    这就像在没有提供任何XML文档的情况下在黑暗中拍摄,但您可以尝试以下方法:

    (//*[local-name()='Property' and namespace-uri()='{URI}' ...])[1]
    

    这是一个常见问题。 那个 //x[1] 不选择一个节点,而 (//x)[1] 做。

    第一种手段 :每个名为 x ,这是它的父级的第一个子级。

    第二种方法 :第一个元素 X