XmlSchemaType.GetBuiltInSimpleType Метод

Определение

Возвращает встроенный XmlSchemaSimpleType простой тип указанного простого типа.

Перегрузки

Имя Описание
GetBuiltInSimpleType(XmlTypeCode)

Возвращает встроенный XmlSchemaSimpleType простой тип указанного простого типа.

GetBuiltInSimpleType(XmlQualifiedName)

XmlSchemaSimpleType Возвращает значение, представляющее встроенный простой тип простого типа, указанного полным именем.

GetBuiltInSimpleType(XmlTypeCode)

Исходный код:
XmlSchemaType.cs
Исходный код:
XmlSchemaType.cs
Исходный код:
XmlSchemaType.cs
Исходный код:
XmlSchemaType.cs
Исходный код:
XmlSchemaType.cs

Возвращает встроенный XmlSchemaSimpleType простой тип указанного простого типа.

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

Параметры

typeCode
XmlTypeCode

Одно из XmlTypeCode значений, представляющих простой тип.

Возвращаемое значение

Объект XmlSchemaSimpleType , представляющий встроенный простой тип.

Примеры

В следующем примере показано, как создать тип и добавить его в схему.

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

Комментарии

Вы не можете напрямую сериализовать встроенный тип. Если необходимо сериализовать тип, создайте новый простой тип, производный от встроенного типа, и сериализуйте простой тип.

Применяется к

GetBuiltInSimpleType(XmlQualifiedName)

Исходный код:
XmlSchemaType.cs
Исходный код:
XmlSchemaType.cs
Исходный код:
XmlSchemaType.cs
Исходный код:
XmlSchemaType.cs
Исходный код:
XmlSchemaType.cs

XmlSchemaSimpleType Возвращает значение, представляющее встроенный простой тип простого типа, указанного полным именем.

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

Параметры

qualifiedName
XmlQualifiedName

Простой XmlQualifiedName тип.

Возвращаемое значение

Объект XmlSchemaSimpleType , представляющий встроенный простой тип.

Исключения

Параметр XmlQualifiedName имеет значение null.

Примеры

В следующем примере показано, как создать тип и добавить его в схему.

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

Комментарии

Вы не можете напрямую сериализовать встроенный тип. Если необходимо сериализовать тип, создайте новый простой тип, производный от встроенного типа, и сериализуйте простой тип.

Применяется к