我有一个xsd重新定义了一个复杂类型来添加一个序列:
<xs:redefine>
<xs:complexType name="data-extension.type">
<xs:complexContent mixed="true">
<xs:extension base="data-extension.type">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="strict"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
但是当我使用JAXB为我的xsd生成代码时,DataExtensionType类没有该序列的字段。 我在xsd或JAXB生成参数中遗漏了什么吗?
修改 这是生成的Java:
/**
* <p>Java class for data-extension.type complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="data-extension.type">
* <complexContent>
* <extension base="{http://graphml.graphdrawing.org/xmlns}data-extension.type">
* <redefine>
* <complexType name="data-extension.type">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* </restriction>
* </complexContent>
* </complexType>
* </redefine>
* <sequence>
* <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "data-extension.type", namespace = "http://graphml.graphdrawing.org/xmlns")
@XmlSeeAlso({
DefaultType.class,
DataType.class
})
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2018-03-02T02:29:07+00:00", comments = "JAXB RI v2.2.8-b130911.1802")
public class DataExtensionType
extends OriginalDataExtensionType
{
}
评论表明在解析过程中发现了序列。
我期待看到List<Object> any
(或类似)及其生成的getter。 supper类有一个contents字段,但其类型为String
。
编辑2:
The OriginalData class:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"content"
})
@XmlSeeAlso({
DataExtensionType.class
})
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2018-03-02T02:29:07+00:00", comments = "JAXB RI v2.2.8-b130911.1802")
public class OriginalDataExtensionType {
@XmlValue
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2018-03-02T02:29:07+00:00", comments = "JAXB RI v2.2.8-b130911.1802")
protected String content;
/**
*
* Extension mechanism for the content of <data> and <default>.
* The complex type data-extension.type is empty per default.
* Users may redefine this type in order to add content to
* the complex types data.type and default.type which are
* extensions of data-extension.type.
*
*
* @return
* possible object is
* {@link String }
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2018-03-02T02:29:07+00:00", comments = "JAXB RI v2.2.8-b130911.1802")
public String getContent() {
return content;
}
/**
* Sets the value of the content property.
*
* @param value
* allowed object is
* {@link String }
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2018-03-02T02:29:07+00:00", comments = "JAXB RI v2.2.8-b130911.1802")
public void setContent(String value) {
this.content = value;
}
}
起初我还希望contents
字段是序列。