XmlSchemaType.GetBuiltInSimpleType Metod

Definition

Returnerar en XmlSchemaSimpleType som representerar den inbyggda enkla typen av den angivna enkla typen.

Överlagringar

Name Description
GetBuiltInSimpleType(XmlTypeCode)

Returnerar en XmlSchemaSimpleType som representerar den inbyggda enkla typen av den angivna enkla typen.

GetBuiltInSimpleType(XmlQualifiedName)

Returnerar en XmlSchemaSimpleType som representerar den inbyggda enkla typen av enkel typ som anges av det kvalificerade namnet.

GetBuiltInSimpleType(XmlTypeCode)

Källa:
XmlSchemaType.cs
Källa:
XmlSchemaType.cs
Källa:
XmlSchemaType.cs
Källa:
XmlSchemaType.cs
Källa:
XmlSchemaType.cs

Returnerar en XmlSchemaSimpleType som representerar den inbyggda enkla typen av den angivna enkla typen.

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

Parametrar

typeCode
XmlTypeCode

Ett av värdena XmlTypeCode som representerar den enkla typen.

Returer

Det XmlSchemaSimpleType som representerar den inbyggda enkla typen.

Exempel

I följande exempel visas hur du skapar typen och lägger till den i schemat.

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

Kommentarer

Du kan inte serialisera den inbyggda typen direkt. Om du behöver serialisera typen skapar du en ny enkel typ som härleds från den inbyggda typen och serialiserar den enkla typen.

Gäller för

GetBuiltInSimpleType(XmlQualifiedName)

Källa:
XmlSchemaType.cs
Källa:
XmlSchemaType.cs
Källa:
XmlSchemaType.cs
Källa:
XmlSchemaType.cs
Källa:
XmlSchemaType.cs

Returnerar en XmlSchemaSimpleType som representerar den inbyggda enkla typen av enkel typ som anges av det kvalificerade namnet.

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

Parametrar

qualifiedName
XmlQualifiedName

Av XmlQualifiedName den enkla typen.

Returer

Det XmlSchemaSimpleType som representerar den inbyggda enkla typen.

Undantag

Exempel

I följande exempel visas hur du skapar typen och lägger till den i schemat.

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

Kommentarer

Du kan inte serialisera den inbyggda typen direkt. Om du behöver serialisera typen skapar du en ny enkel typ som härleds från den inbyggda typen och serialiserar den enkla typen.

Gäller för