XsdDataContractImporter.Import メソッド

定義

XML スキーマのセットを、CLR コードを生成するために使用される CodeCompileUnit に変換します。

オーバーロード

Import(XmlSchemaSet)

XmlSchemaSet に含まれる指定した XML スキーマのセットを CodeCompileUnit に変換します。

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

XmlSchemaSet に含まれる指定したスキーマ型のセットを、CodeCompileUnit 内に生成される CLR 型に変換します。

Import(XmlSchemaSet, XmlSchemaElement)

指定した XML スキーマのセット内の指定したスキーマ要素を CodeCompileUnit に変換し、指定した要素用のデータ コントラクト名を表す XmlQualifiedName を返します。

Import(XmlSchemaSet, XmlQualifiedName)

XmlSchemaSet に含まれる指定した XML スキーマ型を CodeCompileUnit に変換します。

Import(XmlSchemaSet)

XmlSchemaSet に含まれる指定した XML スキーマのセットを CodeCompileUnit に変換します。

public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas);
public void Import (System.Xml.Schema.XmlSchemaSet schemas);
member this.Import : System.Xml.Schema.XmlSchemaSet -> unit
Public Sub Import (schemas As XmlSchemaSet)

パラメーター

schemas
XmlSchemaSet

CLR 型を生成するためのスキーマ表現が格納される XmlSchemaSet

例外

schemas パラメーターが null です。

CanImport メソッドを使用して、スキーマのセットをインポートできるかどうかをテストする例を次に示します。 CanImport メソッドが true を返した場合、コードは Import メソッドを呼び出します。

static CodeCompileUnit Import(XmlSchemaSet schemas)
{

    XsdDataContractImporter imp = new XsdDataContractImporter();

    // The EnableDataBinding option adds a RaisePropertyChanged method to
    // the generated code. The GenerateInternal causes code access to be
    // set to internal.
    ImportOptions iOptions = new ImportOptions();
    iOptions.EnableDataBinding = true;
    iOptions.GenerateInternal = true;
    imp.Options = iOptions;

    if (imp.CanImport(schemas))
    {
        imp.Import(schemas);
        return imp.CodeCompileUnit;
    }
    else
    {
        return null;
    }
}
Shared Function Import(ByVal schemas As XmlSchemaSet) As CodeCompileUnit 

    Dim imp As New XsdDataContractImporter()
   ' The EnableDataBinding option adds a RaisePropertyChanged method to
   ' the generated code. The GenerateInternal causes code access to be
   ' set to internal.
   Dim iOptions As New ImportOptions()
   iOptions.EnableDataBinding = true
   iOptions.GenerateInternal = true
   imp.Options = IOptions

    If imp.CanImport(schemas) Then
        imp.Import(schemas)
        Return imp.CodeCompileUnit
    Else
        Return Nothing
    End If
End Function

適用対象

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

XmlSchemaSet に含まれる指定したスキーマ型のセットを、CodeCompileUnit 内に生成される CLR 型に変換します。

public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Collections::Generic::ICollection<System::Xml::XmlQualifiedName ^> ^ typeNames);
public void Import (System.Xml.Schema.XmlSchemaSet schemas, System.Collections.Generic.ICollection<System.Xml.XmlQualifiedName> typeNames);
member this.Import : System.Xml.Schema.XmlSchemaSet * System.Collections.Generic.ICollection<System.Xml.XmlQualifiedName> -> unit
Public Sub Import (schemas As XmlSchemaSet, typeNames As ICollection(Of XmlQualifiedName))

パラメーター

schemas
XmlSchemaSet

スキーマ表現が格納されている XmlSchemaSet

typeNames
ICollection<XmlQualifiedName>

インポートするスキーマ型のセットを表す (XmlQualifiedName の) ICollection<T>

適用対象

Import(XmlSchemaSet, XmlSchemaElement)

指定した XML スキーマのセット内の指定したスキーマ要素を CodeCompileUnit に変換し、指定した要素用のデータ コントラクト名を表す XmlQualifiedName を返します。

public:
 System::Xml::XmlQualifiedName ^ Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Xml::Schema::XmlSchemaElement ^ element);
public System.Xml.XmlQualifiedName Import (System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.XmlSchemaElement element);
member this.Import : System.Xml.Schema.XmlSchemaSet * System.Xml.Schema.XmlSchemaElement -> System.Xml.XmlQualifiedName
Public Function Import (schemas As XmlSchemaSet, element As XmlSchemaElement) As XmlQualifiedName

パラメーター

schemas
XmlSchemaSet

変換するスキーマを格納する XmlSchemaSet

element
XmlSchemaElement

変換する特定のスキーマ要素を表す XmlSchemaElement

戻り値

指定した要素を表す XmlQualifiedName

例外

schemas パラメーターまたは element パラメーターが null です。

適用対象

Import(XmlSchemaSet, XmlQualifiedName)

XmlSchemaSet に含まれる指定した XML スキーマ型を CodeCompileUnit に変換します。

public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Xml::XmlQualifiedName ^ typeName);
public void Import (System.Xml.Schema.XmlSchemaSet schemas, System.Xml.XmlQualifiedName typeName);
member this.Import : System.Xml.Schema.XmlSchemaSet * System.Xml.XmlQualifiedName -> unit
Public Sub Import (schemas As XmlSchemaSet, typeName As XmlQualifiedName)

パラメーター

schemas
XmlSchemaSet

スキーマ表現が格納されている XmlSchemaSet

typeName
XmlQualifiedName

インポートする特定のスキーマ型を表す XmlQualifiedName

例外

schemas パラメーターまたは typeName パラメーターが null です。

適用対象