XmlSchemaType.GetBuiltInSimpleType Método

Definição

Devolve um XmlSchemaSimpleType que representa o tipo simples incorporado do tipo simples especificado.

Sobrecargas

Name Description
GetBuiltInSimpleType(XmlTypeCode)

Devolve um XmlSchemaSimpleType que representa o tipo simples incorporado do tipo simples especificado.

GetBuiltInSimpleType(XmlQualifiedName)

Devolve um XmlSchemaSimpleType que representa o tipo simples incorporado do tipo simples especificado pelo nome qualificado.

GetBuiltInSimpleType(XmlTypeCode)

Origem:
XmlSchemaType.cs
Origem:
XmlSchemaType.cs
Origem:
XmlSchemaType.cs
Origem:
XmlSchemaType.cs
Origem:
XmlSchemaType.cs

Devolve um XmlSchemaSimpleType que representa o tipo simples incorporado do tipo simples especificado.

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

Parâmetros

typeCode
XmlTypeCode

Um dos XmlTypeCode valores que representa o tipo simples.

Devoluções

O XmlSchemaSimpleType que representa o tipo simples incorporado.

Exemplos

O exemplo seguinte mostra como criar o tipo e adicioná-lo ao esquema.

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

Observações

Não podes serializar diretamente o tipo incorporado. Se precisar de serializar o tipo, crie um novo tipo simples que derive do tipo incorporado e serialize o tipo simples.

Aplica-se a

GetBuiltInSimpleType(XmlQualifiedName)

Origem:
XmlSchemaType.cs
Origem:
XmlSchemaType.cs
Origem:
XmlSchemaType.cs
Origem:
XmlSchemaType.cs
Origem:
XmlSchemaType.cs

Devolve um XmlSchemaSimpleType que representa o tipo simples incorporado do tipo simples especificado pelo nome qualificado.

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

Parâmetros

qualifiedName
XmlQualifiedName

Do XmlQualifiedName tipo simples.

Devoluções

O XmlSchemaSimpleType que representa o tipo simples incorporado.

Exceções

O XmlQualifiedName parâmetro é null.

Exemplos

O exemplo seguinte mostra como criar o tipo e adicioná-lo ao esquema.

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

Observações

Não podes serializar diretamente o tipo incorporado. Se precisar de serializar o tipo, crie um novo tipo simples que derive do tipo incorporado e serialize o tipo simples.

Aplica-se a