![](/img/trans.png)
[英]Unmarshalling maxOccurs unbounded elements having attributes through jaxb
[英]Is it possible to have JAXB ignore order of elements in a <sequence> when one or more elements is a list (maxOccurs=unbounded)?
我一直無法找到答案。 <all>
標簽不是答案,因為它將子元素限制為maxOccurs=“1”
。
假設您有XSD,其中包括:
<xsd:sequence>
<xsd:element name=“name” type=“xsd:string” minOccurs=“1”/>
<xsd:element name=“children” type=“xsd:string” minOccurs=“0” maxOccurs=“unbounded”/>
</xsd:sequence>
有什么方法可以讓JAXB使用此XSD讀取XML,而元素的順序與XSD中定義的順序不同?
我不知道JAXB的完整解決方案。
但是,JAXB綁定用於
<xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element name="children" type="xs:string"/> <xs:element name="name" type="xs:string"/> </xs:choice> </xs:complexType>
將取消編組所需的實例,並在再次編組它們時使其保持穩定。
缺點是:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.