Questions tagged «jaxb»

用于XML绑定的Java体系结构是用于将XML作为域对象使用的Java标准。它提供了一种将Java类映射到XML表示的简单机制。


9
如何告诉jaxb / Maven生成多个模式包?
例: </plugin> <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.7.1</version> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <schemaDirectory>src/main/resources/dir1</schemaDirectory> <schemaIncludes> <include>schema1.xsd</include> </schemaIncludes> <generatePackage>schema1.package</generatePackage> </configuration> </plugin> <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.7.1</version> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <schemaDirectory>src/main/resources/dir2</schemaDirectory> <schemaIncludes> <include>schema2.xsd</include> </schemaIncludes> <generatePackage>schema2.package</generatePackage> </configuration> </plugin> </plugins> 发生了什么:Maven执行了第一个插件。然后删除目标文件夹并创建第二个程序包,该程序包随后将可见。 我尝试为第一个配置设置target / somedir1,为第二个配置设置target / somedir2。但是行为不会改变吗?有任何想法吗?我不想直接在src / main / …
80 maven-2  jaxb  schema  xsd  java 


8
JAXB和属性订购
我希望Java类中的序列化XML输出能够遵循Java类中属性的顺序。 似乎JAXB按字母顺序排序。 我可以通过@XmlType与propOrder一起使用并指定所有属性来覆盖此属性,但是我有一个包含许多属性的类,而这些属性尚未最终确定。 我读到,指定一个空的propOrder可以做到,但事实并非如此。 我的示例课: package test; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; @XmlRootElement //@XmlType(propOrder={"company", "scheme", "agreementNumber"}) @XmlType(propOrder={}) // makes no difference - still alphabetical in XML public class CustomerPlan2 { private String company; private String scheme; private String agreementNumber; @XmlElement(name="Company") public String getCompany() { return company; } public void …
69 java  jaxb  xml-binding 

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.