Java 在XSD中定义字节数组列表
在我的DTO中,我有一个变量Java 在XSD中定义字节数组列表,java,xsd,jaxb,Java,Xsd,Jaxb,在我的DTO中,我有一个变量List attachmentList,我想用XSD对它进行建模。到目前为止,我已经: <xs:element name="attachmentList" type="AttachmentList"> </xs:element> <!-- more code goes here --> <!-- Lis
List attachmentList
,我想用XSD对它进行建模。到目前为止,我已经:
<xs:element name="attachmentList" type="AttachmentList">
</xs:element>
<!-- more code goes here -->
<!-- List of ByteArrays -->
<xs:complexType name="AttachmentList">
<xs:sequence>
<xs:element name="documents" type="ByteArray" nillable="true">
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ByteArray">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="byteArrayElement" type="xs:byte"/>
</xs:sequence>
</xs:complexType>
不幸的是,在由
JAXB
生成的类中,它随后显示为protectedattachmentlist-AttachmentList代码>,附件列表
包含受阵列文档保护的
然后最后,ByteArray
类包含受保护的列表byteArrayElement代码>,这也是不正确的。如何在XSD
中正确定义字节数组列表?字节[]
的正确类型是
这意味着字段列表attachmentList
的XSD应该是:
您可以运行(Java8)命令来生成XSD。也可以从JAXB下载。哦……当然可以!