XSD文字列データ型
文字列データ型は、文字列を含む値に使用されます。
文字列データ型
文字列データ型には、文字、改行、改行、およびタブ文字を含めることができます。
以下は、スキーマでの文字列宣言の例です。
<xs:element name="customer" type="xs:string"/>
ドキュメント内の要素は次のようになります。
<customer>John Smith</customer>
または、次のようになります。
<customer> John Smith </customer>
注:文字列データ型を使用する場合、XMLプロセッサは値を変更しません。
NormalizedStringデータ型
normalizedStringデータ型は、Stringデータ型から派生します。
normalizedStringデータ型にも文字が含まれていますが、XMLプロセッサは改行、キャリッジリターン、およびタブ文字を削除します。
以下は、スキーマでのnormalizedString宣言の例です。
<xs:element name="customer" type="xs:normalizedString"/>
ドキュメント内の要素は次のようになります。
<customer>John Smith</customer>
または、次のようになります。
<customer> John Smith </customer>
注:上記の例では、XMLプロセッサーがタブをスペースに置き換えます。
トークンデータ型
トークンデータ型も文字列データ型から派生します。
トークンデータ型にも文字が含まれますが、XMLプロセッサは、改行、キャリッジリターン、タブ、先頭と末尾のスペース、および複数のスペースを削除します。
以下は、スキーマでのトークン宣言の例です。
<xs:element name="customer" type="xs:token"/>
ドキュメント内の要素は次のようになります。
<customer>John Smith</customer>
または、次のようになります。
<customer> John Smith </customer>
注:上記の例では、XMLプロセッサーがタブを削除します。
文字列データ型
以下のすべてのデータ型は、文字列データ型から派生していることに注意してください(文字列自体を除く)。
Name | Description |
---|---|
ENTITIES | |
ENTITY | |
ID | A string that represents the ID attribute in XML (only used with schema attributes) |
IDREF | A string that represents the IDREF attribute in XML (only used with schema attributes) |
IDREFS | |
language | A string that contains a valid language id |
Name | A string that contains a valid XML name |
NCName | |
NMTOKEN | A string that represents the NMTOKEN attribute in XML (only used with schema attributes) |
NMTOKENS | |
normalizedString | A string that does not contain line feeds, carriage returns, or tabs |
QName | |
string | A string |
token | A string that does not contain line feeds, carriage returns, tabs, leading or trailing spaces, or multiple spaces |
文字列データ型の制限
文字列データ型で使用できる制限:
- 列挙
- 長さ
- maxLength
- minLength
- パターン(NMTOKENS、IDREFS、およびENTITIESはこの制約を使用できません)
- whiteSpace