schema举例二
schema举例二:
1 <?xml version="1.0" encoding="UTF-8"?> 2 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 3 targetNamespace="http://www.weshare.com.cn/hbaseGroup" 4 xmlns="http://www.weshare.com.cn/hbaseGroup" 5 elementFormDefault="qualified"> 6 7 <xs:element name="hbaseGroup"> 8 <xs:complexType> 9 <xs:sequence> 10 <xs:element name="statements" maxOccurs="unbounded"> 11 <xs:complexType> 12 <xs:sequence> 13 <xs:element name="statement" maxOccurs="unbounded"> 14 <xs:complexType> 15 <xs:sequence> 16 <xs:element name="property" maxOccurs="unbounded"> 17 <xs:complexType> 18 <xs:attribute name="type" use="required"/> 19 </xs:complexType> 20 </xs:element> 21 </xs:sequence> 22 </xs:complexType> 23 </xs:element> 24 </xs:sequence> 25 <xs:attributeGroup ref="AttributeGroup"/> 26 </xs:complexType> 27 </xs:element> 28 </xs:sequence> 29 <xs:attribute name="id" type="xs:string" use="required"></xs:attribute> 30 </xs:complexType> 31 </xs:element> 32 33 <xs:attributeGroup name="AttributeGroup"> 34 <xs:attribute name="id" type="xs:string" use="required"/> 35 <xs:attribute name="type" type="xs:string" use="required"/> 36 </xs:attributeGroup> 37 38 </xs:schema>
XML范例:
1 <?xml version="1.0" encoding="UTF-8"?> 2 <hbaseGroup id="id" 3 xmlns="http://www.weshare.com.cn/hbaseGroup" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xsi:noNamespaceSchemaLocation="file:///C:/workspace/Tools/UpdateProject/script_update_common/src/main/resources/schema/project/hbaseGroup.xsd"> 6 <statements id="" type=""> 7 <statement> 8 <property type=""/> 9 <property type=""/> 10 </statement> 11 <statement> 12 <property type=""/> 13 </statement> 14 </statements> 15 <statements id="" type=""> 16 <statement> 17 <property type=""/> 18 </statement> 19 </statements> 20 21 </hbaseGroup>