使用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!
更多推荐
发布评论