从 xsd 生成 xml
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/428359/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
generate xml from xsd
提问by eddy147
Is there an IDE out there that can generate XML from XSD? Not Oxygen or XmlSpy, they are too expensive for me... command line based is ofcourse the preferred method!
是否有可以从 XSD 生成 XML 的 IDE?不是 Oxygen 或 XmlSpy,它们对我来说太贵了……基于命令行的当然是首选方法!
采纳答案by user22940
回答by Fabian Steeg
You can do it in the Eclipse Web Tools (included in the Eclipse IDE for Java EE Developers).
您可以在 Eclipse Web Tools(包含在Eclipse IDE for Java EE Developers 中)中执行此操作。
回答by Magnilex
Note that soon after this answer was originally posted, Apache XMLBeans was retired. As such, I cannot recommend it anymore. Anyway, I am still of the opinion that it had good command line support for generating example xsd:s, but a new release haven't been done in well over 2 years at time of writing.
请注意,在最初发布此答案后不久,Apache XMLBeans 就被淘汰了。因此,我不能再推荐它了。无论如何,我仍然认为它对生成示例 xsd:s 有很好的命令行支持,但在撰写本文时,2 年多来还没有发布新版本。
command line based is ofcourse the preferred method!
基于命令行的当然是首选方法!
In my opinion xsd2instin the Apache XMLBeansis a very good tool for this. It is command line based and ships with binaries for Windows and Unix/Linux.
在我看来,Apache XMLBeans中的xsd2inst是一个非常好的工具。它是基于命令行的,并带有适用于 Windows 和 Unix/Linux 的二进制文件。
It is really simple to use too:
使用起来也很简单:
xsd2inst schemafile.xsd -name globalElementName
xsd2inst schemafile.xsd -name globalElementName
It generates the output directly to the console and can of course easily be piped to a file.
它直接将输出生成到控制台,当然可以轻松地通过管道传输到文件。
Is there an IDE out there that can generate XML from XSD?
是否有可以从 XSD 生成 XML 的 IDE?
IntelliJ Ideahas the same functionality if using an IDE is prefered, even in the community edition. Just right click inside the xsd document and select Generate Instance Document From Schema, then select the root node.
如果首选使用 IDE,则IntelliJ Idea具有相同的功能,即使在社区版中也是如此。只需右键单击 xsd 文档并选择Generate Instance Document From Schema,然后选择根节点。
回答by Rob Prouse
The .NET XML transform classes are pretty easy to use, so if you can't find something, it would be pretty easy to whip together a simple command line utility to do what you want.
.NET XML 转换类非常易于使用,因此如果您找不到某些东西,可以很容易地将一个简单的命令行实用程序组合在一起来执行您想要的操作。
回答by Zac Zeng
The free online XML editor XmlGrid.net has an option to generate XML from schema XSD. The nice thing is that you can specify how many repeatable elements you want and can fill the elements with the default values provided in your schema. It can handle very complicated schemas. Here is the url: http://xmlgrid.net
免费的在线 XML 编辑器 XmlGrid.net 可以选择从模式 XSD 生成 XML。好处是您可以指定所需的可重复元素的数量,并可以使用架构中提供的默认值填充元素。它可以处理非常复杂的模式。这是网址:http: //xmlgrid.net
回答by sam
I used this link: i use c#. but this is a simple step. Load the xsd, generate xml. It generates a sample xml for and element 3 times. http://www.codeproject.com/Articles/400016/Generate-Sample-XML-from-XSD?msg=4279868
我使用了这个链接:我使用 c#。但这是一个简单的步骤。加载xsd,生成xml。它为 和 元素生成 3 次示例 xml。 http://www.codeproject.com/Articles/400016/Generate-Sample-XML-from-XSD?msg=4279868
回答by intltechventures
Useful online utility to Create XML Data From an XSD Schema File http://www.xsd2xml.com/
从 XSD 架构文件创建 XML 数据的有用在线实用程序 http://www.xsd2xml.com/

