xsd定义complexType的列表

本文介绍了如何使用XSD定义一个名为`clist`的节点,其包含一个复杂的类型列表,该类型包括`name`和`title`两个属性。通过JAXB2插件,可以将XSD文件转换为Java代码,以便在Java应用中处理这些数据结构。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

假设有如下结构,node节点下面有一个叫clist的子节点,而子节点下面有一个complexType,它包含name和title两个属性,这里要作为列表返回的就是这个complexType,也就是clist就是保存complexType的List。

用xsd来描述:


<xs:element name="node">
    <xs:complexType>
        <xs:sequence>
            <xs:element name = "clist" maxOccurs
(2)根据下列XML Schema文档定义的XML文档的结构及每个元素的数据类型,自行书写XML文档的数据内容,并设计该XML文档在页面中显示的样式,写出对映的XML文档及对映的xsl文件。 编写折半法查找的程序。 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:simpleType name="bookprice"> <xsd:restriction base="xsd:decimal"> <xsd:totalDigits value="6"/> <xsd:fractionDigits value="2"/> <xsd:minInclusive value="0.00"/> <xsd:maxInclusive value="100.00"/> <!-- 用fractionDigits,totalDigits时 数据 类型应写成 base="xsd:decimal" 写成 float 错误 --> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="category"> <xsd:restriction base="xsd:token"> <xsd:enumeration value="小说"/> <xsd:enumeration value="散文"/> <xsd:enumeration value="传记"/> <xsd:enumeration value="诗歌"/> <xsd:enumeration value="武侠"/> <xsd:enumeration value="纪实"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="categoylist"> <xsd:list itemType="category"/> </xsd:simpleType> <xsd:simpleType name="threeBookCate"> <xsd:restriction base="categoylist"> <xsd:length value="3"/> </xsd:restriction> </xsd:simpleType> <xsd:element name="booklist"> <xsd:complexType> <xsd:sequence> <xsd:element name="categoylist" type="categoylist"/> <xsd:element name="threeBookCategory" type="threeBookCate"/> <xsd:element ref="book"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="book"> <xsd:complexType> <xsd:sequence> <xsd:element name="title" type="xsd:string"/> <xsd:element name="author" type="xsd:string"/> <xsd:element name="price" type="bookprice"/> <xsd:element name="resume" type="xsd:string"/> <xsd:element name="recommendation" type="xsd:string"/> <xsd:element name="publish" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType> <xsd:sequence> <xsd:element name="publisher" type="xsd:string"/> <xsd:element name="pubdate" type="xsd:date"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="category" type="category"/> </xsd:sequence> <xsd:attribute name="isbn" type="xsd:string"/> </xsd:complexType> </xsd:element> </xsd:schema>
最新发布
05-24
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值