在xquery中创建免费的命名空间元素 [英] Creating namespace free Element in xquery
问题描述
我已经创建了此处提到的元素 XQuery:使用给定名称创建新元素吗?.
I have created an element as mentioned here XQuery: Create a new element with a given name?.
用于创建元素的代码如下
The code for creating element is below
declare function local:remove-tag-if-empty($elem as element(), $name as xs:string)
{
if(not($elem/node()))
then ()
else
(
element {$name} {$elem/text()}
)
};
现在我从生成的XML中得到的是这样的东西(我正在使用上面的函数来创建DOB标签)
Now what I am getting from the generated XML is something like this (I am using the above function to create DOB tag)
<DOB xmlns = "">2012-10-14+03:00</DOB>
我不want xmlns=""
成为生成的xml的一部分.谁能告诉我如何创建没有名称空间的元素?提前致谢.
I don't want xmlns=""
to be the part of the generated xml. Can anyone tell me that how to create element without namespace? Thanks in advance.
推荐答案
为什么要创建:
Why do you want to create:
< DOB> 2012-10-14 + 03:00</DOB>
<DOB>2012-10-14+03:00</DOB>
与以下功能相同:
It is functionally the same as below:
< DOB xmlns ="> 2012-10-14 + 03:00</DOB>
<DOB xmlns="">2012-10-14+03:00</DOB>
这篇关于在xquery中创建免费的命名空间元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!