DTSXMLOperation 열거형

정의

XML 문서 작업 시 사용되는 작업을 지정합니다.

public enum class DTSXMLOperation
public enum DTSXMLOperation
type DTSXMLOperation = 
Public Enum DTSXMLOperation
상속
DTSXMLOperation

필드

Diff 4

두 개의 XML 문서를 비교합니다. 비교 작업에서는 원본 XML 문서를 기본 문서로 사용하여 해당 문서를 다른 XML 문서와 비교하고, 차이점을 발견한 다음 해당 차이점을 XML DiffGram 문서에 씁니다. 이 작업에는 비교를 사용자 지정하기 위한 속성이 포함됩니다.

Merge 3

두 개의 XML 문서를 병합합니다. 병합 작업에서는 원본 XML 문서를 기본 문서로 사용하여 두 번째 문서를 기본 문서에 병합합니다. 이 작업에서는 문서의 병합 위치를 지정할 수 있습니다.

Patch 5

DiffGram 문서라고 하는 비교 작업의 출력을 XML 문서에 적용하여 DiffGram 문서 내용이 포함될 수 있는 새로운 상위 문서를 만듭니다.

Validate 0

DTD(문서 유형 정의) 또는 XSD(XML 스키마 정의)와 비교하여 XML 문서의 유효성을 검사합니다.

XPATH 2

XPath 쿼리 및 계산을 수행합니다.

XSLT 1

XML 문서에 대해 XSL 변환을 수행합니다.

예제

다음 코드 예제에서는 작업을 만든 직후 설정 OperationType 하는 데 사용 되는이 열거형을 보여 줌.

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, Books.xml, 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);  
                }  
        }  
}  

샘플 출력:

결과: 성공

설명

이 작업은 클래스의 다른 속성이 XMLTask 유효한지 결정합니다. 예를 들어 선택한 작업이 있으면 XPATH속성 PutResultInOneNodeXPathOperation 사용되고 사용됩니다. 작업이 수행되면 ValidateFailOnValidationFail 플래그를 사용할 수 있습니다. 이 속성은 일반적으로 코드에서 설정된 첫 번째 속성이므로 수행 중인 작업을 XMLTask 즉시 확인할 수 있습니다.

적용 대상