在MarkLogic中从XML转换为JSON时的特定类型(Specifiy type when converting from XML to JSON in MarkLogic)

编程入门 行业动态 更新时间:2024-10-28 13:23:45
在MarkLogic中从XML转换为JSON时的特定类型(Specifiy type when converting from XML to JSON in MarkLogic)

使用MarkLogic 8,我正在为json:transform-to-json使用自定义XML到JSON的转换, 除了转换输出数字作为字符串之外 ,我已经让它正常工作了。

有没有办法指定特定元素的值应该是数字值,而不是字符串?

我在json:config的doc中没有看到任何内容,但为了防止我错过了什么,或者如果你有一个简洁的后处理技巧,我很想知道如何解决这个问题。

Using MarkLogic 8, I'm using a custom XML to JSON conversion for json:transform-to-json, and I've got it working just about right except the conversion is outputting numbers as strings.

Is there a way to specify that the value of a particular element should be a number value, not a string?

I don't see anything in the doc for json:config, but just in case there's something I've missed, or if you have a neat post-processing trick, I'd love to hear about how to solve this problem.

最满意答案

您可以通过为非字符串类型元素定义XML模式来实现此目的。 只需确保它在上下文中可用(通过将其加载到xdmp:schemas-database()),并且它被识别(您的XML需要具有与XML Schema匹配的命名空间,并且您可能想要使用import schema) ..

HTH!

You can do that by defining an XML Schema for the non-string type elements. Just make sure it is available in the context (by loading it into xdmp:schemas-database()), and that it is recognized (your XML needs to have a namespace that matches the XML Schema, and you might wanna use import schema)..

HTH!

更多推荐

本文发布于:2023-07-18 11:36:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1159788.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   类型   MarkLogic   XML   JSON

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!