xpath - 如何让方法 B 发挥作用?
使用方法 A 的模式和 xpath 来读取和映射无界节点(“详细信息”)可以输出多条消息。唯一的问题是设计 xsd 模式时无界节点必须始终处于序列中。 在我正在使用的消息分配对象中,我尝试读取和映射的实例 XPath 是
XPathVar = System.String.Format(“
/* [local-name()=’header’ and namespace-uri()=’http://namespace’]
/* [local-name()=’detail’ and namespace-uri()=’http://namespace’] and
position() = {0}]”, nLoopCount)
如果我没有直接在 header
节点之后的 detail
节点,那么它无法抛出类似于“构造块末尾包含空值”的异常。有什么办法可以让方法B发挥作用吗? 即
这个方法有效!
[Method A]
<schema>
<header> (Node)
<detail> (Node) unbounded
<child elements>
</detail>
<additional info> (Node)
<child elements>
</additional info>
</header>
则会抛出类似于“构造块末尾包含空值”的异常
[Method B]
<schema>
<header> (Node)
<additional info> (Node)
<child elements>
</additional info>
<detail> (Node) unbounded
<child elements>
</detail>
</header>
但这不起作用,并且如果有其他元素或节点分隔 << , 。标题>且<详情>>在模式中比我得到异常错误。
谁能阐明这个问题?
Using the Schema of Method A with xpath to read and map the unbounded node (“detail”) is working to output multiple messages. The only issue is that designing the xsd schema the unbounded node must always be in a sequence.
In the Message Assignment object I am using, the instance XPath that I am trying to read and map is
XPathVar = System.String.Format(“
/* [local-name()=’header’ and namespace-uri()=’http://namespace’]
/* [local-name()=’detail’ and namespace-uri()=’http://namespace’] and
position() = {0}]”, nLoopCount)
If I don’t have the detail
node straight after the header
node than it fails throwing an exception similar to ‘contained a null value at the end of the construct block’. Is there any way to get Method B to work?
i.e
This method works!
[Method A]
<schema>
<header> (Node)
<detail> (Node) unbounded
<child elements>
</detail>
<additional info> (Node)
<child elements>
</additional info>
</header>
but this Does Not Work and throws an exception similar to ‘contained a null value at the end of the construct block’
[Method B]
<schema>
<header> (Node)
<additional info> (Node)
<child elements>
</additional info>
<detail> (Node) unbounded
<child elements>
</detail>
</header>
if there are other elements or Nodes separating the < header > and < detail > in a schema than I get the exception error.
Can anyone shed any light on this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你想使用这个:
解释:以下经常选择等效的集合:
但是,当使用
位置
时,这会失败。考虑这个表达式:它选择以下两个都为真的所有元素:
condition1
为 true但是,这个表达式:
... first 选择
condition1
为 true 的所有元素,then 选取第一个这样的元素。这是一个微妙但重要的区别。
I think that you want to use this:
Explanation: The following often select equivalent sets:
However, this breaks down when using
position
. Consider this expression:It selects all elements for which both of the following are true:
condition1
is trueHowever, this expression:
...first selects all elements for which
condition1
is true and then takes the first such element.It's a subtle but important difference.