81,122
社区成员




<school>
<!-- global -->
<student id="1">
<name>Li Xiao Ming</name>
<age>7</age>
</student>
<monitor>
<!-- localReference -->
<student ref="1" />
</monitor>
</school>
<school>
<monitor>
<!-- local -->
<student>
<name>Wang Gang</name>
<age>7</age>
</student>
</monitor>
</school>
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/test"
xmlns:tns="http://www.example.org/test" elementFormDefault="qualified">
<xsd:element name="school">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="student" type="tns:GlobalStudentType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="monitor">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="student" type="tns:InnerStudentType" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="StudentType" abstract="true">
<xsd:sequence minOccurs="0">
<xsd:element name="name" type="xsd:string" />
<xsd:element name="age" type="xsd:unsignedShort" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID" />
<xsd:attribute name="ref" type="xsd:IDREF" />
</xsd:complexType>
<xsd:complexType name="GlobalStudentType">
<xsd:complexContent>
<xsd:restriction base="tns:StudentType">
<xsd:sequence minOccurs="1">
<xsd:element name="name" type="xsd:string" />
<xsd:element name="age" type="xsd:unsignedShort" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID" use="required" />
<xsd:attribute name="ref" type="xsd:IDREF" use="prohibited" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="LocalStudentType">
<xsd:complexContent>
<xsd:restriction base="tns:StudentType">
<xsd:sequence minOccurs="1">
<xsd:element name="name" type="xsd:string" />
<xsd:element name="age" type="xsd:unsignedShort" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID" use="prohibited" />
<xsd:attribute name="ref" type="xsd:IDREF" use="prohibited" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="LocalRefStudentType">
<xsd:complexContent>
<xsd:restriction base="tns:StudentType">
<xsd:sequence minOccurs="0">
<xsd:element name="name" type="xsd:string" />
<xsd:element name="age" type="xsd:unsignedShort" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID" use="prohibited" />
<xsd:attribute name="ref" type="xsd:IDREF" use="required" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="InnerStudentType">
<!-- How to designed this? Should LocalStudentType and LocalRefStudentType be used? -->
</xsd:complexType>
</xsd:schema>