3.16. XML Task

The XML task is a new comprehensive task that can perform many different functions with your XML files. It allows SSIS to dynamically modify, merge, or create XML files at runtime. The functions this task can perform include the following:

  • Take a series of XML files and merge them into a single file

  • Prepare an XML file for a report by applying an XSLT style sheet to it

  • Select out pieces of an XML file using XPATH

  • Compare two XML files and write the differences to an XML Diffgram

  • Validate the XML files against a Document Type Definition (DTD)

You configure the task through the XML Task Editor in the General tab. This very large dialog box changes based on what OperationType you select. The OperationType option has several different types of settings:

  • Validate: Validates the XML document against the Document Type Definition (DTD) document or the XML Schema Definition (XSD) schema

  • XSLT: Performs an XSL transformation against your XML document

  • XPATH: Performs an XPATH query against the XML document

  • Merge: Merges two XML documents into a single file

  • Diff: Compares two XML documents

  • Patch: Creates a new document from the previously mentioned Diff operation

If you're using the XPATH OperationType, you can set the XPathStringSource option to determine what options you'd like to query in the XML file. Figure 3-24 shows an example of how to use the XPATH operation to pull certain countries out of the orders.xml file and output the results to a variable called XPathResult.

Figure ...

Get Professional SQL Server™ 2005 Integration Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.