简体   繁体   中英

Specifiy type when converting from XML to JSON in MarkLogic

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM