XmlSchemaType.GetBuiltInSimpleType XmlSchemaType.GetBuiltInSimpleType XmlSchemaType.GetBuiltInSimpleType XmlSchemaType.GetBuiltInSimpleType Method

Definition

Returns an XmlSchemaSimpleType that represents the built-in simple type of the specified simple type.

Overloads

GetBuiltInSimpleType(XmlTypeCode) GetBuiltInSimpleType(XmlTypeCode) GetBuiltInSimpleType(XmlTypeCode) GetBuiltInSimpleType(XmlTypeCode)

Returns an XmlSchemaSimpleType that represents the built-in simple type of the specified simple type.

GetBuiltInSimpleType(XmlQualifiedName) GetBuiltInSimpleType(XmlQualifiedName) GetBuiltInSimpleType(XmlQualifiedName) GetBuiltInSimpleType(XmlQualifiedName)

Returns an XmlSchemaSimpleType that represents the built-in simple type of the simple type that is specified by the qualified name.

GetBuiltInSimpleType(XmlTypeCode) GetBuiltInSimpleType(XmlTypeCode) GetBuiltInSimpleType(XmlTypeCode) GetBuiltInSimpleType(XmlTypeCode)

Returns an XmlSchemaSimpleType that represents the built-in simple type of the specified simple type.

public:
 static System::Xml::Schema::XmlSchemaSimpleType ^ GetBuiltInSimpleType(System::Xml::Schema::XmlTypeCode typeCode);
public static System.Xml.Schema.XmlSchemaSimpleType GetBuiltInSimpleType (System.Xml.Schema.XmlTypeCode typeCode);
static member GetBuiltInSimpleType : System.Xml.Schema.XmlTypeCode -> System.Xml.Schema.XmlSchemaSimpleType
Public Shared Function GetBuiltInSimpleType (typeCode As XmlTypeCode) As XmlSchemaSimpleType

Parameters

typeCode
XmlTypeCode XmlTypeCode XmlTypeCode XmlTypeCode

One of the XmlTypeCode values representing the simple type.

Returns

Examples

The following example shows how to create the type and add it to the schema.

using System;
using System.Xml;
using System.Xml.Schema;

namespace GetBuiltInSimpleType
{
    class Program
    {
        static void Main(string[] args)
        {
            XmlSchema schema = new XmlSchema();
            XmlSchemaSimpleType stringType = new XmlSchemaSimpleType();
            stringType.Name = "myString";
            schema.Items.Add(stringType);
            XmlSchemaSimpleTypeRestriction stringRestriction = 
                                 new XmlSchemaSimpleTypeRestriction();
            stringRestriction.BaseTypeName = 
                                 new XmlQualifiedName("string",
                         "http://www.w3.org/2001/XMLSchema");
            stringType.Content = stringRestriction;
            schema.Write(Console.Out);
        }
    }
}

Imports System
Imports System.Xml
Imports System.Xml.Schema
Module Module1

    Sub Main()

        Dim schema As XmlSchema = New XmlSchema()
        Dim stringType As XmlSchemaSimpleType = New XmlSchemaSimpleType()
        stringType.Name = "myString"
        schema.Items.Add(stringType)
        Dim stringRestriction As XmlSchemaSimpleTypeRestriction = _
                                 New XmlSchemaSimpleTypeRestriction()
        stringRestriction.BaseTypeName = _
                                 New XmlQualifiedName("string", _
                                 "http://www.w3.org/2001/XMLSchema")
        stringType.Content = stringRestriction
        schema.Write(Console.Out)

    End Sub

End Module

Remarks

You cannot directly serialize the built-in type. If you need to serialize the type, create a new simple type which derives from the built-in type and serialize the simple type.

GetBuiltInSimpleType(XmlQualifiedName) GetBuiltInSimpleType(XmlQualifiedName) GetBuiltInSimpleType(XmlQualifiedName) GetBuiltInSimpleType(XmlQualifiedName)

Returns an XmlSchemaSimpleType that represents the built-in simple type of the simple type that is specified by the qualified name.

public:
 static System::Xml::Schema::XmlSchemaSimpleType ^ GetBuiltInSimpleType(System::Xml::XmlQualifiedName ^ qualifiedName);
public static System.Xml.Schema.XmlSchemaSimpleType GetBuiltInSimpleType (System.Xml.XmlQualifiedName qualifiedName);
static member GetBuiltInSimpleType : System.Xml.XmlQualifiedName -> System.Xml.Schema.XmlSchemaSimpleType
Public Shared Function GetBuiltInSimpleType (qualifiedName As XmlQualifiedName) As XmlSchemaSimpleType

Parameters

Returns

Exceptions

Examples

The following example shows how to create the type and add it to the schema.

using System;
using System.Xml;
using System.Xml.Schema;

namespace GetBuiltInSimpleType
{
    class Program
    {
        static void Main(string[] args)
        {
            XmlSchema schema = new XmlSchema();
            XmlSchemaSimpleType stringType = new XmlSchemaSimpleType();
            stringType.Name = "myString";
            schema.Items.Add(stringType);
            XmlSchemaSimpleTypeRestriction stringRestriction = 
                                 new XmlSchemaSimpleTypeRestriction();
            stringRestriction.BaseTypeName = 
                                 new XmlQualifiedName("string",
                         "http://www.w3.org/2001/XMLSchema");
            stringType.Content = stringRestriction;
            schema.Write(Console.Out);
        }
    }
}

Imports System
Imports System.Xml
Imports System.Xml.Schema
Module Module1

    Sub Main()

        Dim schema As XmlSchema = New XmlSchema()
        Dim stringType As XmlSchemaSimpleType = New XmlSchemaSimpleType()
        stringType.Name = "myString"
        schema.Items.Add(stringType)
        Dim stringRestriction As XmlSchemaSimpleTypeRestriction = _
                                 New XmlSchemaSimpleTypeRestriction()
        stringRestriction.BaseTypeName = _
                                 New XmlQualifiedName("string", _
                                 "http://www.w3.org/2001/XMLSchema")
        stringType.Content = stringRestriction
        schema.Write(Console.Out)

    End Sub

End Module

Remarks

You cannot directly serialize the built-in type. If you need to serialize the type, create a new simple type which derives from the built-in type and serialize the simple type.

Applies to