使用 XQuery 设置常量值
I have been trying to assign values to the elements of an incoming xml(from a queue) using xquery. The in coming xml is of the form
<header><a></a><b></b><c></c></header>
i need to set them with constant values for the target system:
<header><a>1</a><b>2</b><c>3</c></header>
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我是否完全理解您的问题,但我假设您想要复制输入并修改某些元素。使用 XSLT 可以最轻松地完成此操作。
要在 XQuery 中执行此操作,您需要一个递归函数来查看每个节点,在适当的情况下对其进行修改,然后复制输出。根据您的描述,我假设您的输入仅由元素节点组成,因此这是我考虑过的唯一情况:
I'm not sure if I understand your question fully, but I assume you are wanting to copy the input and modify certain elements. This would be most easily done with XSLT.
To do this in XQuery you want a recursive function that looks at each node, modifies it if appropriate, and the copies the output. From your description, I assume your input consists only of element nodes, and so this is the only case I have considered: