java - JAXB unmarshals incomplete objects when using XSD <choice> element -
I am facing a problem that is using a JMAB RI 2.2.1 in an XML document.
element is defined as (full XSD is too large for posting):
& Lt; Xsd: complex type name = "PatternExpression_Type" & gt; & Lt; XSD: Options & gt; & Lt; Xsd: element riff = "pattern" /> & Lt; XSD: Sequence & gt; & Lt; Xsd: element riff = "pattern operator" /> & Lt; Xsd: likes maxOccurs = "unbounded" & gt; & Lt; Xsd: element riff = "pattern" /> & Lt; Xsd: element ref = "patternexpress" minOccurs = "0" maxOccurs = "unbounded" /> & Lt; / XSD: Options & gt; & Lt; / XSD: Sequence & gt; & Lt; / XSD: Options & gt; & Lt; / XSD: complexType & gt;
Here is the XML that I am trying to unbalance:
& lt; PatternExpression & gt; & Lt; PatternOperator tc = "2" & gt; And & lt; / PatternOperator & gt; & Lt; Pattern & gt; & Lt; PropertyName & gt; First & lt; / PropertyName & gt; & Lt; PropertyValue & gt; John & lt; / PropertyValue & gt; & Lt; / Pattern & gt; & Lt; Pattern & gt; & Lt; PropertyName & gt; Last name & lt; / PropertyName & gt; & Lt; PropertyValue & gt; Do & lt; / PropertyValue & gt; & Lt; / Pattern & gt; & Lt; / PatternExpression & gt;
When I run the document through unmarshaller, the resulting PatternExpression object contains PatternOperator and a single pattern, which is the last one in the sequence.
Do anyone have any suggestions on why the pattern items are not being added to the list list?
I think the presence of Pattern Operator will allow JAXB to determine how the element falls in it.
FYI, XML Schema is governed by a third party, so it has to be modified.
Comments
Post a Comment