Setting the XSD File Path of an XML Data Source from a Variable

gravatar

Paul S. Waters

This snippet shows how to set the file path of a XML Schema that is set from a package variable. Notice that two file connections are declared under the Biml root node. One for the XML schema and one for the XML file. The XSD file path is set in the Connections node inside the Package node, by setting the file connections ConnectionString property with an expression.

published 11.20.13

last updated 11.20.13


Share

Tags

  • Data Source
  • XML
                            


<Biml xmlns="http://schemas.varigence.com/biml.xsd">
    <Connections>
        <FileConnection Name="XmlFile" FilePath="C:\test\XmlFile.xml" RelativePath="true" />
        <FileConnection Name="XmlXsd" FilePath="C:\test\XmlXsd.Xsd" RelativePath="true" />
	</Connections>
	<Packages>
        <Package Name="Package1" ConstraintMode="Parallel">
			<Variables>
                <Variable Name="SchemaFolder" DataType="String">C:\Schemas\</Variable>
            </Variables>
            <Tasks>
                <Dataflow Name="DataflowTask1">
                    <Transformations>
                        <XmlSource Name="XMLSource1">
                            <XmlSchemaFileInput ConnectionName="XmlXsd" />
                        	<FileInput ConnectionName="XmlFile" />
                        </XmlSource>
                    </Transformations>
                </Dataflow>
            </Tasks>
            <Connections>
                <Connection ConnectionName="XmlXsd">
                    <Expressions>
                        <Expression PropertyName="XmlXsd.ConnectionString"> @[User::SchemaFolder] + "GetDTSColumns.xsd"</Expression>
                    </Expressions>
                </Connection>
            </Connections>
        </Package>
    </Packages>
</Biml>
                        

This snippet shows how to set the file path of a XML Schema that is set from a package variable. Notice that two file connections are declared under the Biml root node. One for the XML schema and one for the XML file. The XSD file path is set in the Connections node inside the Package node, by setting the file connections ConnectionString property with an expression.

You are not authorized to comment. A verification email has been sent to your email address. Please verify your account.

Comments

gravatar

arun

5:49am 04.21.16

Hi Paul, I am trying to load an XML File to a database table, XML has the nodes as (EmpID, Name, Address1 and Address2) , I wanted to load this into Two tables Employee(EmpID,Name) and EmployeeAddress(EmplD,Address1,Address2)

Problem I'm Facing: When i'm trying to Input Path for OLEDB destination its throwing Error in ,Im using the below code, Can you please help on identifying the issue

  <Tasks >
   <Dataflow Name="DataflowTask1">
      <Transformations>
        <XmlSource Name="XMLSource1">
          <XmlSchemaFileInput ConnectionName="XmlXsd" />
          <FileInput ConnectionName="XmlFile" />
        </XmlSource>

        <OleDbDestination Name="OLe DB Des" ConnectionName="Destination" >
         ** <InputPath OutputPathName="XMLSource1.Output">  </InputPath>**
          <ExternalTableOutput Table="[Employee]" >

          </ExternalTableOutput>
          <Columns>
            <Column SourceColumn="empid" TargetColumn="EmpID"  />
            <Column SourceColumn="name" TargetColumn="Empname"  />

          </Columns>
        </OleDbDestination>
      </Transformations>
    </Dataflow>
   </Tasks>
</Package>

gravatar

Frans4

7:11am 11.09.17

Hi Arun, the output path of the XmlSource component is named "ROW" instead of "Output". It confused me, too!

gravatar

Frans4

7:11am 11.09.17

Hi Arun, the output path of the XmlSource component is named "ROW" instead of "Output". It confused me, too!