XML Types


The XML types group includes primitive and derived types that relate to XML document processing. Figure A-4 shows the XSD type hierarchy for this group. As you can see in the figure, all the primitive types appear in ovals.

click to expand
Figure A-4: The XML type group

Primitive XML Types

The primitive XML types are anyURI, NOTATION, QName, and string.

anyURI

The anyURI type represents the set of all URIs (which is the set of all URLs and URNs) written in accordance with RFCs 2396 and 2732. These can be relative or absolute and include a fragment identifier.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

length, minLength, maxLength, pattern, enumeration, whiteSpace

Examples

<uri>http://www.microsoft.com</uri> <uri>urn:uuid:4D36E96A-E325-11CE-BFC1-08002BE10318</uri> <uri>urn:notashop/wscr:AppA</uri> 

NOTATION

The NOTATION type represents the XML 1.0 NOTATION type, which is used to identify the format of non-XML data. Note that the NOTATION type cannot be used directly in a schema. You must first derive a type from it using the enumeration facet and then use it only for attributes.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

length, minLength, maxLength, pattern, enumeration, whiteSpace

Examples

<xs:simpleType name='mediaPlayers'>   <xs:restriction base='xs:NOTATION'>     <xs:enumeration value='wmp' />     <xs:enumeration value='real' />     <xs:enumeration value='qcd' />   </xs:restriction> </xs:simpleType> 

QName

The QName type represents the set of all fully qualified names that comply with the Namespaces In XML specification. That is, they contain a namespace URI and a local name (an NCName), separated by a colon.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.Xml. XmlQualifiedName

Applicable Facets

length, minLength, maxLength, pattern, enumeration, whiteSpace

Examples

<QN>xsd:element</QN> <QN>wscr:alongunwieldyQName</QN> 

string

The string type represents all finite-length strings of Unicode characters (ISO-10646) that comply with the Char production in XML 1.0.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

normalizedString

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

length, minLength, maxLength, pattern, enumeration, whiteSpace

Examples

<str>String</str> <str>99 Pink Elephants</str> <str>Wo ist Himbeerstra e?</str> 

Derived XML Types

normalizedString

The normalizedString type represents the set of all white space–normalized characters— that is, all strings that do not contain the carriage return (#xD), line feed (#xA), or tab (#x9) character. To normalize a string containing those characters, you replace those characters with spaces.

Base Type

Derived Type

SQL Server Type

.NET Type

string

token

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

enumeration, length, maxLength, minLength, pattern, whiteSpace

Examples

<nStr>no line    feeds here</nStr> <nStr>   pas de weiss spaces  </nStr> 

token

The token type represents the set of all tokenized strings—all normalized strings (as just described) that have no internal sequence of two or more spaces and no leading or trailing spaces.

Base Type

Derived Type

SQL Server Type

.NET Type

normalizedString

language, NMTOKEN, Name

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

enumeration, length, maxLength, minLength, pattern, whiteSpace

Examples

<tok>no extraneous spaces here</tok> <tok>pas de weiss spaces</tok> 

language

The language type represents the set of all valid language identifiers as given in the XML 1.0 specification. This data type is usually used with attributes.

Base Type

Derived Type

SQL Server Type

.NET Type

token

N/A

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

enumeration, length, maxLength, minLength, pattern, whiteSpace

Examples

<element lang = "en-GB"/> <element lang = "es" /> 

NMTOKEN

The NMTOKEN type represents the XML 1.0 NMTOKEN type—all literal values containing one or more of the following characters: a letter, digit, period, comma, underscore, or colon. NMTOKEN should be used only on attributes.

Base Type

Derived Type

SQL Server Type

.NET Type

token

NMTOKENS

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

enumeration, length, maxLength, minLength, pattern, whiteSpace

Examples

<element NMT="token_of_some_sort" /> <element NMT="but,with,no,spaces" /> 

NMTOKENS

The NMTOKENS type represents the XML 1.0 NMTOKENS type—all white space– separated lists of NMTOKEN values. NMTOKENS should be used only on attributes.

Base Type

Derived Type

SQL Server Type

.NET Type

NMTOKEN

N/A

N/A

System.String[]

Applicable Facets

enumeration, length, maxLength, minLength, whiteSpace

Examples

<element NMTS="token of some sort" /> <element NMTS="nmtoken1 nmtoken2 nmtoken3" /> 

Name

The Name type represents the set of all valid XML 1.0 Names.

Base Type

Derived Type

SQL Server Type

.NET Type

token

NCName

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

enumeration, length, maxLength, minLength, pattern, whiteSpace

Examples

<name>Whizzo_Chocolate</name> <name>asd:some.name</name> 

NCName

The NCName type represents the set of all valid XML 1.0 Names that do not contain colons. NCNames are most commonly used as local names for XML elements. NCName stands for noncolonized name.

Base Type

Derived Type

SQL Server Type

.NET Type

Name

ID, IDREF, ENTITY

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

enumeration, length, maxLength, minLength, pattern, whiteSpace

Examples

<NCN>Crunchy_Frog</NCN> <NCN>no.colons-here</NCN> 

ID

The ID type represents the XML ID attribute and the set of all strings that can be used as XML element IDs. This is the set of all valid NCNames.

Base Type

Derived Type

SQL Server Type

.NET Type

NCName

N/A

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

enumeration, length, maxLength, minLength, pattern, whiteSpace

Examples

<ID>Viking-spam</ID> <ID>Calendar_Header_1</ID> 

IDREF

The IDREF type represents the XML IDREF attribute and the set of all strings that can be used as XML element IDs. An XML IDREF must match an ID value elsewhere in the same XML document and should be used only as an attribute value. This schema type set is the set of all valid NCNames.

Base Type

Derived Type

SQL Server Type

.NET Type

NCName

IDREF

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

enumeration, length, maxLength, minLength, pattern, whiteSpace

Examples

<a ref="Viking-spam" /> <a ref="Calendar_Header_1" /> 

IDREFS

The IDREFS type represents the XML IDREFS attribute and the set of all finite, nonzero-length space-delimited lists of IDREF strings that can be used as XML element IDs. An XML IDREF must match an ID value elsewhere in the same XML document and should be used only as an attribute value.

Base Type

Derived Type

SQL Server Type

.NET Type

IDREF

N/A

N/A

System.String[]

Applicable Facets

enumeration, length, maxLength, minLength, pattern, whiteSpace

Examples

<a ref="Viking-spam spam_and_chips spam_sandwich" /> <a ref="Calendar_Header_1 Calendar_Header_2" /> 

ENTITY

The ENTITY type represents the XML ENTITY attribute and the set of all strings that can be used as XML entities. The value given must match an unparsed ENTITY declared elsewhere in the document and should be used only as an attribute. This schema type set is the set of all valid NCNames.

Base Type

Derived Type

SQL Server Type

.NET Type

Name

ENTITIES

VARCHAR, TEXT, NVARCHAR, or NTEXT

System.String

Applicable Facets

enumeration, length, maxLength, minLength, pattern, whiteSpace

Examples

<something  /> <something  /> 

ENTITIES

The ENTITIES type represents the XML ENTITIES attribute and the set of all finite, nonzero-length space-delimited lists of ENTITY strings that can be used as XML element IDs. An XML ENTITY must match an ID value elsewhere in the same XML document and should be used only as an attribute value.

Base Type

Derived Type

SQL Server Type

.NET Type

ENTITY

N/A

N/A

System.String[]

Applicable Facets

enumeration, length, maxLength, minLength, pattern, whiteSpace

Examples

<something  /> <something  /> 




Programming Microsoft. NET XML Web Services
Programming MicrosoftВ® .NET XML Web Services (Pro-Developer)
ISBN: 0735619123
EAN: 2147483647
Year: 2005
Pages: 172

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net