Sdílet prostřednictvím


XmlSchemaType.GetBuiltInSimpleType Metoda

Definice

Vrátí hodnotu XmlSchemaSimpleType , která představuje integrovaný jednoduchý typ zadaného jednoduchého typu.

Přetížení

GetBuiltInSimpleType(XmlTypeCode)

Vrátí hodnotu XmlSchemaSimpleType , která představuje integrovaný jednoduchý typ zadaného jednoduchého typu.

GetBuiltInSimpleType(XmlQualifiedName)

Vrátí hodnotu XmlSchemaSimpleType , která představuje integrovaný jednoduchý typ jednoduchého typu, který je určen kvalifikovaným názvem.

GetBuiltInSimpleType(XmlTypeCode)

Vrátí hodnotu XmlSchemaSimpleType , která představuje integrovaný jednoduchý typ zadaného jednoduchého typu.

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

Parametry

typeCode
XmlTypeCode

Jedna z XmlTypeCode hodnot představujících jednoduchý typ.

Návraty

XmlSchemaSimpleType

To XmlSchemaSimpleType představuje integrovaný jednoduchý typ.

Příklady

Následující příklad ukazuje, jak vytvořit typ a přidat ho do schématu.

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.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

Poznámky

Nelze přímo serializovat předdefinovaný typ. Pokud potřebujete serializovat typ, vytvořte nový jednoduchý typ, který je odvozen od integrovaného typu a serializovat jednoduchý typ.

Platí pro

GetBuiltInSimpleType(XmlQualifiedName)

Vrátí hodnotu XmlSchemaSimpleType , která představuje integrovaný jednoduchý typ jednoduchého typu, který je určen kvalifikovaným názvem.

public:
 static System::Xml::Schema::XmlSchemaSimpleType ^ GetBuiltInSimpleType(System::Xml::XmlQualifiedName ^ qualifiedName);
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

Parametry

qualifiedName
XmlQualifiedName

Jednoduchý XmlQualifiedName typ.

Návraty

XmlSchemaSimpleType

To XmlSchemaSimpleType představuje integrovaný jednoduchý typ.

Výjimky

Příklady

Následující příklad ukazuje, jak vytvořit typ a přidat ho do schématu.

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.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

Poznámky

Nelze přímo serializovat předdefinovaný typ. Pokud potřebujete serializovat typ, vytvořte nový jednoduchý typ, který je odvozen od integrovaného typu a serializovat jednoduchý typ.

Platí pro