XML task in SSIS
XML task in SSIS
XML task in SSIS
In this article we will learn about XML task in SSIS. XML task is used to validate, modify, extract or even create files in an XML format.
Drag XML task from tool box and drop on Control flow tab as shown in Figure1
Figure 1
Double click xml task which displays XML task editor as shown in Figure 2 which is having only two tabs. In General tab, you need to specify the connections and type of operation should be performed.
Figure 2
General tab properties changed based on the OperationType selected. The XML operation types are as follows.
Secondoperation tab specifies source type and source that contains second XML document to complete the selected operation.
Lets us understand XML task with an example which uses validates an XML using validate option
Steps to follow:
In this article we will learn about XML task in SSIS. XML task is used to validate, modify, extract or even create files in an XML format.
Drag XML task from tool box and drop on Control flow tab as shown in Figure1
Figure 1
Double click xml task which displays XML task editor as shown in Figure 2 which is having only two tabs. In General tab, you need to specify the connections and type of operation should be performed.
Figure 2
General tab properties changed based on the OperationType selected. The XML operation types are as follows.
- Validate: This option allows XML file schema validation against Document Type Definition (DTD) or XML Schema Definition (XSD) binding control documents. XML task with this option makes sure that XML file is in required format.
- XSLT: The Extensible Stylesheet Language Transformations (XSLT) are a subset of the XML language that enables transformation of XML data.
- XPATH: This option uses the XML Path Language and allows the extraction of sections or specific nodes from the structure of the XML document. This option will be used to extract data from XML nodes.
- Merge: This option allows for the merging of two XML documents with the same structure. this option will be used to combine the results of two extracts from different systems into one document.
- Diff: This option allows us to compare two XML documents to produce a third document called an XML Diffgram that contains the differences between them.
- Patch: This option applies the results of a Diff operation to an XML document to create a new XML document.
Secondoperation tab specifies source type and source that contains second XML document to complete the selected operation.
Lets us understand XML task with an example which uses validates an XML using validate option
Steps to follow:
- Create one dummy xml file as mentioned below. You can create using any available XML editor.
- Generate XSD/XML schema either through any generate tool or online. I have created below XSD document using online tool saved as text_xml.xsd
If you execute the package, Task will be executed successfully and turned into Green color and writes true into text.txt file which indicates XML file contains the correct schema as defined by XSD file. If you want you can test giving wrong XML file which writes false into file
0 comments:
Post a Comment