DTSXMLSourceType 列挙体

SourceType の場所、XPathStringSourceType における XPath 文字列のソースの種類、および SecondOperandType におけるオペランド 2 の型を記述します。使用される型によっては、SourceXPathStringSourceSecondOperand の各プロパティの間に互換性が存在しなければなりません。たとえば、SourceType を FileConnection に設定する場合、Source は接続マネージャを含む必要があります。SourceType が Variable である場合には、Source は使用する変数を指定する必要があります。

名前空間:  Microsoft.SqlServer.Dts.Tasks.XMLTask
アセンブリ:  Microsoft.SqlServer.XMLTask (Microsoft.SqlServer.XMLTask.dll)

構文

'宣言
Public Enumeration DTSXMLSourceType
'使用
Dim instance As DTSXMLSourceType
public enum DTSXMLSourceType
public enum class DTSXMLSourceType
type DTSXMLSourceType
public enum DTSXMLSourceType

メンバー

メンバー名 説明
FileConnection XML ドキュメントをファイルに保存することを示します。タスクは、接続マネージャと対話して、ファイルから XML ドキュメントを取得します。このタスクに対するユーザー インターフェイスを記述する場合は、ファイル接続マネージャの取得をサポートする操作に [新しい接続] ボタンも用意し、ユーザーがタスクの編集中に新しい接続を作成できるようにする必要があります。
Variable XML ドキュメントを変数に保存することを示します。

このタスクのユーザー インターフェイスを記述する場合は、現在の変数の一覧をユーザーに対して示し、ユーザーがソースとして 1 つの変数を選択できるようにする必要があります。変数の使用をサポートする操作では、[新しい変数] ボタンも用意し、ユーザーがタスクの編集中に新しい変数を作成できるようにする必要があります。

DirectInput XML ドキュメントをタスクのユーザー インターフェイスの領域にプレーン テキストで直接入力することを示します。このオプションは、タスクのユーザー インターフェイスが提供されている場合にのみ使用します。

使用例

次のコード例では、この列挙を使用して、タスクに SourceTypeSecondOperandType を設定しています。

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.XMLTask;

namespace XMLTask_API
{
    class Program
        {
        static void Main(string[] args)
                {
                        // Set up the objects and tasks.
                        Package pkg = new Package();
                        Executable exec1 = pkg.Executables.Add("STOCK:XMLTask");
                        TaskHost th = exec1 as TaskHost;
                        // You can cast the InnerObject to the XmlTask,
                        // but it is advised that you work with tasks
                        // through the TaskHost and its Properties.
                        // XMLTask myTask = th.InnerObject as XMLTask;

                        // Create a variable and a FILE connection
                         // manager to books.xml.
                        Variable resultVar = pkg.Variables.Add("resultVariable", false, "", "Variable for the result");
                        ConnectionManager connMgr = pkg.Connections.Add("FILE");
                        connMgr.Name = "XMLConnectionManager";
                        // The file is stored on the C:\ drive.
                        connMgr.ConnectionString = @"c:\books.xml";

                        // Set the XMLTask properties.
                        // The first property to set is the
                         // OperationType. Depending on the
                        // OperationType, different properties are
                         // valid.
                        // The operation type in this example is 
                        // VALIDATE.
                        th.Properties["OperationType"].SetValue(th, DTSXMLOperation.Validate);
                        th.Properties["SourceType"].SetValue(th, DTSXMLSourceType.FileConnection);
                        th.Properties["Source"].SetValue(th, connMgr.Name);
                        th.Properties["OverwriteDestination"].SetValue(th, true);
                        th.Properties["SaveOperationResult"].SetValue(th, true);
                        th.Properties["DestinationType"].SetValue(th, DTSXMLSaveResultTo.Variable);
                        th.Properties["Destination"].SetValue(th, resultVar.Name);
                        th.Properties["SecondOperandType"].SetValue(th, DTSXMLSourceType.DirectInput);
                        th.Properties["SecondOperand"].SetValue(th, "<x></x>");
                        th.Properties["ValidationType"].SetValue(th, DTSXMLValidationType.DTD);
                        th.Properties["FailOnValidationFaile"].SetValue(th, true);
                        DTSExecResult valResults = pkg.Validate(pkg.Connections, pkg.Variables, null, null);
                        Console.WriteLine("RESULTS: {0}", valResults);
                }
        }
}

サンプルの出力 :

RESULTS: Success