在 Node.js 中基于 xml 模式构建 xml [英] Build xml based on xml schema in Node.js

查看:18
本文介绍了在 Node.js 中基于 xml 模式构建 xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么简单的方法可以在 Node.js 中基于 XML 模式创建 XML?目前我看到像 xmlbuilder 这样的模块确实有助于从头开始创建 XML(不遵循模式).我想要一些基于 XML 模式/XSD 的高级别的东西,这将有助于创建 xml.就像 POJO 是基于 XSD 创建的,现在很容易填充 POJO,然后创建 XML.

Is there any easy way to create XML based on XML schema in Node.js? Currently I see modules like xmlbuilder that does help in creating XML from scratch ( does not follow schema). I want something high level, based on XML schema /XSD which will help in creating xml. Like POJOs are created based on XSD and now easy to populate POJOs and then create XML.

感谢您的任何提示...

Thanks for any hints...

推荐答案

我是Jsonix的作者 这是一个强大的模式驱动的 XML<->JS 转换器,可以在 Node.js 和浏览器中工作.

I am the author of Jsonix which is a powerful schema-driven XML<->JS converter, working in Node.js as well as in browsers.

有关完整示例,请参阅此答案:

See this answer for a complete example:

Schema-driven 意味着您可以使用 XML Schema 并从中生成 Jsonix 映射.然后,您可以序列化符合原始 XML 模式的 JSON 数据或在该模式中解组 XML.Jsonix 考虑了模式的类型和结构.

Schema-driven means that you can take an XML Schema and generate Jsonix mappings out of it. You can then serialize your JSON data conforming to the original XML Schema or unmarshal XML in that schema. Jsonix considers types and structures of the schema.

这篇关于在 Node.js 中基于 xml 模式构建 xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆