Database Reference
In-Depth Information
out bCancel);
}
}
}
static IEnumerable<XElement> StreamReader(String
filename, string elementName)
{
using (XmlReader xr = XmlReader.Create(filename))
{
xr.MoveToContent();
while (xr.Read())
{
while (xr.NodeType == XmlNodeType.Element &&
xr.Name == elementName)
{
XElement node
= (XElement)XElement.ReadFrom(xr);
yield return node;
}
}
xr.Close();
}
}
Conclusion
The XML Source component lets you process XML documents from an SSIS data flow
without writing any code. Although it can handle most XML schemas, it tends to work
best with simple XML documents. When dealing with complex XML formats, consider
using XSLT to reformat the source document to a format that is easily parsed. If you
don't mind writing and maintaining .NET code, consider using one of the script com-
ponent patterns described in this chapter when you need more control over how a docu-
ment is parsed, are working with large XML documents, or have specific performance
requirements.
Search WWH ::




Custom Search