XmlSchemaType.GetBuiltInSimpleType メソッド

定義

指定された単純型の組み込み単純型を表す XmlSchemaSimpleType を返します。

オーバーロード

GetBuiltInSimpleType(XmlTypeCode)

指定された単純型の組み込み単純型を表す XmlSchemaSimpleType を返します。

GetBuiltInSimpleType(XmlQualifiedName)

修飾名で指定された単純型の組み込み単純型を表す XmlSchemaSimpleType を返します。

GetBuiltInSimpleType(XmlTypeCode)

指定された単純型の組み込み単純型を表す 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 値の 1 つ。

戻り値

XmlSchemaSimpleType

組み込み単純型を表す 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)

修飾名で指定された単純型の組み込み単純型を表す 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

組み込み単純型を表す 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

注釈

組み込み型を直接シリアル化することはできません。 型をシリアル化する必要がある場合は、組み込み型から派生した新しい単純型を作成し、その単純型をシリアル化します。

適用対象