tags:

views:

258

answers:

1

Hi All;

DataSet ds = GetExcelToXml("test.xls");

string filename = "C:\\test.xml";

FileStream myFileStream = new FileStream(filename, FileMode.Create);

XmlTextWriter myXmlWriter = new XmlTextWriter(myFileStream, Encoding.Default);

ds.WriteXml(myXmlWriter);

myXmlWriter.Close();

Output Xml

<NewDataSet>
  <Table>
    <UserName>bla1</User_Name>
    <Mail>[email protected]</Mail>
    <Address>World</Address>
  </Table>
</NewDataSet>

I need Xml Node Name

    <ROWS>
      <ROW>
        <UserName>bla1</User_Name>
        <Mail>[email protected]</Mail>
        <Address>World</Address>
      </ROW>
    </ROWS>

How To Make ?

A: 

XmlDocument myXml;

myXml.Load(myXmlWriter); //Not sure if this will work, but you get the idea

myXml.InnerXml = myXml.InnerXml.Replace("< NewDataSet", "< ROWS").Replace("< /NewDataSet>", "< /ROWS>").Replace("< Table", "< ROW").Replace("< /Table>", "< /ROW>");

CMercs