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

查看:136
本文介绍了基于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.

感谢您的提示...

推荐答案

我是 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:

模式驱动意味着您可以采用XML模式并从中生成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天全站免登陆