XML string to DataTable
-
Hi, I'm trying to do something that seems pretty easy. I have a xml string that I want in a datatable. I think the biggest problem is with getting the schems into the datatable. I can't use the Path.xsd because I don't know it at this point. I want to read the schema from the xml string. public void XMLStringToDataTable(string as_xml, ref DataTable adt_working) { if (adt_working == null) adt_working = new DataTable(); StringReader lstr_temp = new StringReader(as_xml); XmlTextReader lxmlReader = new XmlTextReader(lstr_temp); adt_working.ReadXmlSchema(lxmlReader); adt_working.ReadXml(lxmlReader); adt_working.AcceptChanges(); } Is there any easier/ better way to do this? One that works? I would like to use a datatable instead of a dataset if possible. sample xml string: 62291905/4/2006 00:00:002test5/4/2006 00:00:00N16471678 Thanks, Jessica
-
Hi, I'm trying to do something that seems pretty easy. I have a xml string that I want in a datatable. I think the biggest problem is with getting the schems into the datatable. I can't use the Path.xsd because I don't know it at this point. I want to read the schema from the xml string. public void XMLStringToDataTable(string as_xml, ref DataTable adt_working) { if (adt_working == null) adt_working = new DataTable(); StringReader lstr_temp = new StringReader(as_xml); XmlTextReader lxmlReader = new XmlTextReader(lstr_temp); adt_working.ReadXmlSchema(lxmlReader); adt_working.ReadXml(lxmlReader); adt_working.AcceptChanges(); } Is there any easier/ better way to do this? One that works? I would like to use a datatable instead of a dataset if possible. sample xml string: 62291905/4/2006 00:00:002test5/4/2006 00:00:00N16471678 Thanks, Jessica
sorry about the xml string sample. That didn't work how I wanted it to. Thanks, Jessica -- modified at 12:29 Thursday 4th May, 2006