Reading from a XML Source

I am trying read certain attribute from a XML Source based on a particular attribute.

My XML source has the following Structure:<Database ID = "1" Source = "ABC" ></Database><Database ID = "2" Source = "ABC" ></Database><Database ID = "3" Source = "DEF" ></Database>.

I would like to fetch the list of IDs filtering upon Source = "ABC". (which should idealy give me 1,2)

I tried using the For Each Nodelist Enumerator By specifying the Enumeration type as Node and IDrect Input for the OuterXpathString as DATABASE[@Source="ABC"].

The for each loop fails giving the following error. Data is invalid. line 1 position 1.

Can anyone help me out with the same. Is there any other way around to obtain the required result

Pranathi




Answer this question

Reading from a XML Source

  • C Kissinger

    uh...SimonSa is right. I did not notice that. XMLSource adapter will give you the same error. You can put a root node pair to wrap your xml, then try out again either way.

  • Aryan Patel

    Your xml files doesn't look valid as you have more than one root node, this isn't normally allowed.

  • onewebclick

    Have you tried to import your xmlfile using XMLSource adapter in SSIS dataflow task Then you can use ConditionalSplit at XMLSrc downstream to direct your rows to diffrent branches.

    Thanks

    Wenyang



  • Reading from a XML Source