Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想确认 JAXB 是否会按照模式文件中的说明维护元素顺序?
例如:下面是我用来解组 XML 的 XSD 文件的摘录。
<xs:sequence> <xs:element name="stateID" type="xs:string"/> <xs:element name="countryCode" type="xs:string"/> </xs:sequence>
JAXB 会确保stateID元素在元素之前countryCode吗?
stateID
countryCode
在 JAXB 中,注解propOrder上的属性@XmlType用于指定 JAXB 实现将遵循的顺序。如果您的 JAXB 模型是从 XML 模式生成的,那么它将包含此注释。
propOrder
@XmlType
了解更多信息