Hi people!
i need to generate an xml using c#.net.how am i supposed to do,give me an example.
As i am a new comer for.Net.Try to explain me with crisp and clear.
Hope i get a best possible solution.
Generate xml using c#
7 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Niradhip ChakrabortyRank #428 · 5.8K pointsPosted Jun 16, 2008, 10:51 PM EDT
Check Out the following article by Mahesh:
http://www.c-sharpcorner.com/UploadFile/mahesh/ReadWriteXMLTutMellli2111282005041517AM/ReadWriteXMLTutMellli21.aspx
You also can refer following article:
http://www.devsource.com/c/a/Languages/Loading-Parsing-and-Generating-XML-using-C-and-the-SystemXML-Namespace/
Nick Nichols9 pointsPosted Jun 17, 2008, 12:58 AM EDT
murali3 pointsPosted Jun 17, 2008, 1:22 AM EDT
Niradhip ChakrabortyRank #428 · 5.8K pointsPosted Jun 17, 2008, 4:29 AM EDT
You can refer the following articles for code in c# to generate xml.
http://www.codeproject.com/KB/XML/csharpcodedocumentation.aspx
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=773
But the best way to learn is go for some books on xml.
Former memberPosted Jun 17, 2008, 5:25 AM EDT
Friend this link vl give all basics about XML and also Xslt
www.topxml.com
http://weblogs.asp.net/sonukapoor/articles/133356.aspx
Bechir BejaouiRank #144 · 15.9K pointsPosted Jun 17, 2008, 6:35 AM EDT
XmlDataDocument myDoc = new XmlDataDocument(); XmlElement E1 = myDoc.CreateElement("Element1"); XmlAttribute att1 = myDoc.CreateAttribute("attribute1"); XmlAttribute att2 = myDoc.CreateAttribute("attribute2"); att1.value = "value1"; att2.value = "value2"; E1.attributes.append(att1); E1.attributes.append(att2); myDoc.appendchild(E1); myDoc.save(@"C:\myFile.xml");excute the code and brwose to the path C:\myFile.xml and see what happens
This technology is called DOM document object model
murali3 pointsPosted Jun 19, 2008, 10:09 PM EDT
i have generated an xml but fully hard code.Like
start element many child's and for that child i have sub-childs and end element.
so coding goes on and on.
Initially i want to take the worksheet names from an excel and column names and values from the excel.i have mentioned all the columns for getting the column names.I guess this is hard code.how can i simplify this.I guess you all understood.
thanks to all the friends in advance.