2017-01-26 19 views
1

、例えば:違い/類似要素制約のない要素との違いは何

<?xml version="1.0" encoding="utf-8"?> 
<xs:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:tns="http://tempuri.org/import" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:element name="a"></xs:element> 
</xs:schema> 

とタイプxs:anyTypeを持つ要素、例えば:

<?xml version="1.0" encoding="utf-8"?> 
<xs:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:tns="http://tempuri.org/import" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:element name="b" type="xs:anyType"></xs:element> 
</xs:schema> 

いずれもコンテンツを許可し、制約を課しません。違いはありますか?私は関連する仕様書を読んできましたが、それらの違いについての私の混乱を明らかにしていません(もしあれば)。

答えて

2

違いはありません。

xs:element/@typeのデフォルト値はur-typeで、それ以外の場合はanyTypeとなります。

3.3.2 XML Representation of Element Declaration Schema Componentsを見る

{type definition}[children]<simpleType>又は<complexType>要素情報項目に対応する型定義を、どちらかが存在する場合、そうでない場合type定義 ·resolved··actual value·によってそうでなければ 要素宣言の{type definition}のタイプ[attribute]の例えば、 の場合は·ur-type definition·となる。

も参照してください2.2.1.1 Type Definition Hierarchy

[定義:]著名な複合型定義、名前のXMLスキーマの名前空間にanyType型ですウル型 定義は、 存在し、各·XML Schema·には、そのスキーマの定義階層 のルートとして機能します。

関連:XML Schema: what's the default type of an xsd:attribute?

関連する問題