i am writting a c# fonction that convert xml file to csv file but i get an error which i cannot find a solution can any one help?
protected static string page_load()
{
string xmlString = System.IO.File.ReadAllText(@"D:....file.xml");
DataSet ds = new DataSet();
StringReader stringReader = new StringReader(xmlString);
ds.ReadXml(stringReader);
DataTable dtstring = new DataTable();
dtString = ds.Tables[0];
}
at line 4 : ds.ReadXml(stringReader); i'am getting "Failed to initialize the configuration system"
<?xml version=""1.0"" encoding=""utf-8"" ?>
<DOCUMENT>
<ABCS>
<ABC>
<abc_id style_sid=""-4939636236138949558"" style_code=""""/>
<abc item_sid=""-4939635934019714433"" upc=""30109"" use_qty_decimals=""0"" prod_cost="""" reclass_item_sid=""""/>
<abc_c_d>
<abc_c_ds no=""1"" value=""""/>
<abc_c_ds no=""2"" value=""""/>
<abc_c_ds no=""3"" value=""""/>
<abc_c_ds no=""4"" value=""""/>
<abc_c_ds no=""5"" value=""""/>
<abc_c_ds no=""6"" value=""""/>
<abc_c_ds no=""7"" value=""""/>
<abc_c_ds no=""8"" value=""""/>
<abc_c_ds no=""9"" value=""""/>
<abc_c_ds no=""10"" value=""""/>
<abc_c_ds no=""11"" value=""""/>
<abc_c_ds no=""12"" value=""""/>
<abc_c_ds no=""13"" value=""""/>
<abc_c_ds no=""14"" value=""""/>
</abc_c_d>
</ABC>
</ABCS>
</DOCUMENT>
Your XML is not a valid XML file and you need to escape double quote characters in your attributes if it is intended to be there.
How to escape double quotes in XML attributes values?
Replace:
with