当在 XSD 中将 complexType 标记为 mixed="true" 时,生成的 Java 类会生成一个 List,该 List 具有“String”类型或围绕实际值的 JAXBElement 包装器。如果没有 mixed="true",则不会生成 JAXBElement,并且值会直接映射到类型类。例如:
<xs:complexType name="div" mixed="true">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="a" minOccurs="0" maxOccurs="unbounded" type="anchorType"/>
</xs:sequence>
...
</complexType>
这里的 div 类型将包含一个 List getContent() 方法,该方法为 AnchorType 返回一个字符串或一个 JAXBElement。
我希望它只返回没有 JAXBElement 的 String 或 AnchorType。