如何从 Java 中的 xsd 创建对象树? [英] How to create object tree from xsd in Java?

查看:31
本文介绍了如何从 Java 中的 xsd 创建对象树?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何从 XSD 文件在 Java 中创建对象树.有没有这方面的框架?

I want to know how can we create an Object tree in java from an XSD file. Is there any framework for this?

函数签名会有点接近这个:

The function signature will somewhat be close to this:

TreeSet<Object> convertToTree(File xsdFile);

所以你可以看到函数 convertToTree 应该读取 xsd 文件并生成一个 Tree 集合.

So you can see the function convertToTree should read the xsd file and generate a Tree collection.

有人也可以发一些例子吗?

Can someone please post some examples as well?

推荐答案

您可以选择使用 JAXBXMLBean.

You have the options of using JAXB or XMLBean.

如果您需要示例,请参阅 从 XML 模式文件生成 JAXB 类

If you need an example see generate JAXB classes from an XML schema file or

这样做:"%java_home%\bin\xjc" -p [package_name] [xsd_file].xsd

这篇关于如何从 Java 中的 xsd 创建对象树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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