Foreach Loop parsing XML nodes


i have following xml file:

<multirslist>
   <rs id="blah"> 
     <fg name="me"/>
     <fg name="pe"/>

      <sg name="support team"/>
      <sg name="sales team"/>
   </rs>

  <rs id="blah"> 
     <fg name="ce"/>
     <fg name="de"/>
      <sg name="support team"/>
      <sg name="sales team"/>
   </rs>


 </multirslist>

 

i'm trying foreach lop container pass script task rs element. possible?

i have enumerator = foreach nodelist enumerator

enumeratortype = elementcollection

outerxpathstrungsourcetype=directinput

outerxpathstring = /multirslist/rs/

innerelementtype = node

innerxpathstringsourcetype = directinput

innerxpathstring = @*

 

also map user variable type string index =0

 

i have variable contain entire rs tag in script task can manipulate.

 

with above settings i'm getting error:

the enumerator failed retrieve element @ index "0"

 anonymous123sdaf wrote:

 

i want both...the entire element inlcluding rs element , attibutes , child elements...<rs>....</rs>

ok.

1. set foreach container these values:

documentsourcetype : direct input
documentsource : <your xml above>
enumeration type : node
outerxpathstringsourcetype : direct input
outerxpathstring : multirslist/rs

2. map variable of object type

3. use variable (which have system.xml.xmlelement type in reality) in script task



SQL Server  >  SQL Server Integration Services



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........