XML 模式 complexType 元素
摘要
可选。指定是否可以在实例文档中使用复杂类型。True 表示元素不能直接使用这种复杂类型,而必须使用从这种复杂类型派生的复杂类型。默认为假。参考
XML 模式扩展元素
扩展元素扩展了现有的 simpleType 或 complexType 元素。参考
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified" targetNamespace="yourNameSpace"
xmlns="yourNameSpace" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="Person" abstract="true">
<xs:attribute name="First" type="xs:string"/>
<xs:attribute name="Last" type="xs:string"/>
</xs:complexType>
<xs:complexType name="Employee">
<xs:complexContent>
<xs:extension base="Person">
<xs:attribute name="SSN" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Customer">
<xs:complexContent>
<xs:extension base="Person">
<xs:attribute name="CustomerID" type="xs:integer"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Oracle SOA Web 服务不将抽象类型识别为可用类型。
XML Schema 任何元素
any 元素使作者能够使用模式未指定的元素来扩展 XML 文档。参考
请参阅命名空间属性以添加限制。
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified" targetNamespace="yourNameSpace"
xmlns="yourNameSpace" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Person" type="Person"/>
<xs:complexType name="Person">
<xs:sequence>
<xs:any minOccurs="0" namespace="##targetNamespace"/>
</xs:sequence>
<xs:attribute name="First" type="xs:string"/>
<xs:attribute name="Last" type="xs:string"/>
</xs:complexType>
<xs:complexType name="Employee">
<xs:attribute name="SSN" type="xs:string"/>
</xs:complexType>
<xs:complexType name="Customer">
<xs:attribute name="CustomerID" type="xs:integer"/>
</xs:complexType>
</xs:schema>