<!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:EN-GB;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->
Hi,
I have two Streams, one containing an XML file and the other an XSD.
I currently upload the XML stream to an SQL Server database using SQLXMLBulkLoad.
The problem I have is that if one element\attribute fails during the upload then nothing is uploaded. Therefore using the XSD, I would like to strip out any invalid “rows” prior to the upload.
My data takes the following structure, where Column1 and Column2 are integers.
<TableName>
<Row>
<Column1>1</Column1>
<Column2>2</Column2>
</Row>
<Row>
<Column1>1</Column1>
<Column2>2</Column2>
</Row>
<Row>
<Column1>1</Column1>
<Column2>B</Column2>
</Row>
</TableName>
In the above example, Column2 in the 3rd Row is invalid. Therefore I would like to remove it from the XML.
Is this possible in C#? My ideal solution would not load the whole stream in to Memory.
Thanks,
Ben.