xsd.exe / XMLSerializer是否适用于Java?

时间:2022-10-12 17:17:48

Is there something akin to the .NET xsd.exe for java - generating classes from a schema that you can easily de-serialize ? - or , What's the common practice for parsing and pull out/validate the content xml documents in Java ?

是否有类似于.NET的.NET xsd.exe - 从可以轻松反序列化的模式生成类? - 或者,在Java中解析和提取/验证内容xml文档的常见做法是什么?

Traversing a DOM tree and littering code with XPath queries to get the data you need seems quiet messy.

遍历DOM树并使用XPath查询乱丢代码以获取所需的数据似乎很安静。

1 个解决方案

#1


What you're after a data binding framework for XML. The popular ones are JAXB, JiBX and XmlBeans. They all allow you to take an XML schema and generate a bunch of java classes, and also have a runtime component which serializes/deserializes to and from XML and objects.

您在XML的数据绑定框架之后的用途。流行的是JAXB,JiBX和XmlBeans。它们都允许您采用XML模式并生成一堆java类,还有一个运行时组件,用于对XML和对象进行序列化/反序列化。

No one of them is the clear winner, they each have their strengths. JAXB is now included as part of Java 6, so that'd be my default choice.

他们中没有一个是明显的赢家,他们各自都有自己的优势。 JAXB现在作为Java 6的一部分包含在内,因此这是我的默认选择。

#1


What you're after a data binding framework for XML. The popular ones are JAXB, JiBX and XmlBeans. They all allow you to take an XML schema and generate a bunch of java classes, and also have a runtime component which serializes/deserializes to and from XML and objects.

您在XML的数据绑定框架之后的用途。流行的是JAXB,JiBX和XmlBeans。它们都允许您采用XML模式并生成一堆java类,还有一个运行时组件,用于对XML和对象进行序列化/反序列化。

No one of them is the clear winner, they each have their strengths. JAXB is now included as part of Java 6, so that'd be my default choice.

他们中没有一个是明显的赢家,他们各自都有自己的优势。 JAXB现在作为Java 6的一部分包含在内,因此这是我的默认选择。