MarkLogic补丁和名称空间前缀

时间:2017-07-07 14:59:45

标签: marklogic

当提供的片段使用时,是否有办法强制MarkLogic补丁保留前缀? documentation for rapi:insert说"插入元素,文本,注释和处理指令时,指定新节点应该出现在目标文档中,"但它并不总是保留前缀,我也没有办法告诉它。

应用此补丁:

<rapi:patch xmlns:rapi="http://marklogic.com/rest-api"
    xmlns:t1="http://test.com/test1" xmlns:t2="http://test.com/test2">
    <rapi:insert context="/t1:one" position="last-child">
        <t2:two t2:prefixed-attribute="foo">stuff</t2:two>
    </rapi:insert>
</rapi:patch>

到这个文件:

<t1:one xmlns:t1="http://test.com/test1"/>

结果:

<t1:one xmlns:t1="http://test.com/test1">
    <two t2:prefixed-attribute="foo" xmlns="http://test.com/test2"
        xmlns:t2="http://test.com/test2">stuff</two>
</t1:one>

虽然这是有效的XML,但这是一种奇怪的做法,我关心的原因是它会导致某些下游处理出现问题,而这些处理显然并不期望这些节点上的声明。

如果父t1:one个节点已声明xmlns:t2,那么它可以根据需要运行,但我使用的数据不会(并且不应该)有那个。我还尝试在补丁中的插入节点上声明xmlns:t2,但它没有帮助。

使用MarkLogic版本9.0-1.1。

0 个答案:

没有答案