Building Proof of Concepts with XML test Data

There are many times where I want to create a Proof of Concept (POC) that uses a data table.  There are situations when I build these POC that I don’t want to connect to to Database,but still need a datatable.  There are times where I don’t want to create the plumb, or I want to create example that are not specific to the project I’m working, just something more generic. So to get around this problem of connecting to DB, I decided to use XML for the source data.
Today I had some problems with a 3rd party component. I didn’t want to post my companies code on the web, so I create a POC and used XML as the data.  I loaded the XML in a Dataset, which allowed me to the data through a DataTable.
I couldn’t get the POC working without the first line of the xml that follows
xmlData.AppendLine(""<?xml version=’1.0′ standalone=’yes’?>");
xmlData.AppendLine(" <ValidationExpression>");
xmlData.AppendLine("  <ID=’101′ Checked=’true’ Name=’Email’ ValidationSeverityID=’201′  />");
xmlData.AppendLine("  <ID=’102′ Checked=’false’ Name=’Phone Number’ />");
xmlData.AppendLine("  <ID=’103′ Checked=’false’ Name=’Social Security’ />");
xmlData.AppendLine("  <ID=’104′ Checked=’false’ Name=’Date’ />");
xmlData.AppendLine("  <ID=’105′ Checked=’false’ Name=’US Zip + 4′ />");
xmlData.AppendLine("  <ID=’106′ Checked=’false’ Name=’US Zip (5 Only)’ />");
xmlData.AppendLine("  <ID=’107′ Checked=’true’ Name=’Date’  ValidationSeverityID=’203’/>");
xmlData.AppendLine(" </ValidationExpression>");
xmlData.AppendLine(" <ValidationSeverity>");
xmlData.AppendLine("  <ID=’201′ Name=’Error’ />");
xmlData.AppendLine("  <ID=’202′ Name=’Warning’ />");
xmlData.AppendLine("  <ID=’203′ Name=’Info’ />");
xmlData.AppendLine(" </ValidationSeverity>");
System.IO.StringReader xmlSR = new System.IO.StringReader(xmlData);
This create 4 tables in the Data Set.
MSDN – Loading a DataSet from XML (ADO.NET)

Leave a Reply

Your email address will not be published. Required fields are marked *