<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>XML and XmlDataSource Control</title><link>http://forums.asp.net/43.aspx</link><description>All about XML, XSLT, and the XmlDataSource control.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Append datas on xml file with xmlwriter class</title><link>http://forums.asp.net/thread/2611925.aspx</link><pubDate>Wed, 10 Sep 2008 09:13:32 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2611925</guid><dc:creator>chetan.gobbur</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2611925.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=2611925</wfw:commentRss><description>&lt;p&gt; But how to add Node inside node? The Code is having idependent Tags.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Append datas on xml file with xmlwriter class</title><link>http://forums.asp.net/thread/2361395.aspx</link><pubDate>Fri, 16 May 2008 05:05:55 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2361395</guid><dc:creator>Gery128</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2361395.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=2361395</wfw:commentRss><description>&lt;font color="#0000ff"&gt;
&lt;p&gt;there is no need to convert xmlWriter class.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;string&lt;/font&gt; xmlFile = System.Web.&lt;font color="#2b91af"&gt;HttpContext&lt;/font&gt;.Current.Server.MapPath(&lt;font color="#a31515"&gt;&amp;quot;~/App_Data/Candidates.xml&amp;quot;&lt;/font&gt;);&lt;/p&gt;
&lt;p&gt;xmldoc = &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#2b91af"&gt;XmlDocument&lt;/font&gt;();&lt;/p&gt;
&lt;p&gt;xmldoc.Load(xmlFile);&lt;/p&gt;
&lt;p&gt;root = xmldoc.DocumentElement;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff"&gt;try&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af"&gt;XmlNode&lt;/font&gt; CandidateNode = xmldoc.CreateNode(&lt;font color="#2b91af"&gt;XmlNodeType&lt;/font&gt;.Element, &lt;font color="#a31515"&gt;&amp;quot;Candidate&amp;quot;&lt;/font&gt;, &lt;font color="#a31515"&gt;&amp;quot;&amp;quot;&lt;/font&gt;);&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af"&gt;XmlNode&lt;/font&gt; id = xmldoc.CreateNode(&lt;font color="#2b91af"&gt;XmlNodeType&lt;/font&gt;.Element, &lt;font color="#a31515"&gt;&amp;quot;CandidateId&amp;quot;&lt;/font&gt;, &lt;font color="#a31515"&gt;&amp;quot;&amp;quot;&lt;/font&gt;);&lt;/p&gt;
&lt;p&gt;id.InnerText = &lt;font color="#2b91af"&gt;&amp;quot;1&amp;quot;;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;CandidateNode.AppendChild(id);&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af"&gt;XmlNode&lt;/font&gt; subPositionId = xmldoc.CreateNode(&lt;font color="#2b91af"&gt;XmlNodeType&lt;/font&gt;.Element, &lt;font color="#a31515"&gt;&amp;quot;SubPositionId&amp;quot;&lt;/font&gt;, &lt;font color="#a31515"&gt;&amp;quot;&amp;quot;&lt;/font&gt;);&lt;/p&gt;
&lt;p&gt;subPositionId.InnerText = candidate.PositionId.ToString();&lt;/p&gt;
&lt;p&gt;CandidateNode.AppendChild(subPositionId);&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af"&gt;XmlNode&lt;/font&gt; firstName = xmldoc.CreateNode(&lt;font color="#2b91af"&gt;XmlNodeType&lt;/font&gt;.Element, &lt;font color="#a31515"&gt;&amp;quot;FirstName&amp;quot;&lt;/font&gt;, &lt;font color="#a31515"&gt;&amp;quot;&amp;quot;&lt;/font&gt;);&lt;/p&gt;
&lt;p&gt;firstName.InnerText = candidate.FirstName;&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af"&gt;XmlNode&lt;/font&gt; lastName = xmldoc.CreateNode(&lt;font color="#2b91af"&gt;XmlNodeType&lt;/font&gt;.Element, &lt;font color="#a31515"&gt;&amp;quot;LastName&amp;quot;&lt;/font&gt;, &lt;font color="#a31515"&gt;&amp;quot;&amp;quot;&lt;/font&gt;);&lt;/p&gt;
&lt;p&gt;lastName.InnerText = candidate.LastName;&lt;/p&gt;
&lt;p&gt;CandidateNode.AppendChild(firstName);&lt;/p&gt;
&lt;p&gt;CandidateNode.AppendChild(lastName);&lt;/p&gt;
&lt;p&gt;root.AppendChild(CandidateNode);&lt;/p&gt;
&lt;p&gt;xmldoc.Save(xmlFile);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This will help you.&lt;/p&gt;</description></item><item><title>Re: Append datas on xml file with xmlwriter class</title><link>http://forums.asp.net/thread/2360101.aspx</link><pubDate>Thu, 15 May 2008 14:17:37 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2360101</guid><dc:creator>antonpious</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2360101.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=2360101</wfw:commentRss><description>Hi Eric &lt;br /&gt;
With .NET 2.0 there is another new overload of XmlWriter which takes in a TextWriter which is used to specify if you need to append to the file or not &lt;br /&gt;


Here is a sample
XmlWriterSettings settings = null;&lt;br /&gt;
XmlWriter writer = null;&lt;br /&gt;
&lt;br /&gt;
settings.Indent = true;&lt;br /&gt;
settings.OmitXmlDeclaration = true;&lt;br /&gt;
settings.NewLineOnAttributes = true;&lt;br /&gt;
&lt;br /&gt;
settings = new XmlWriterSettings();&lt;br /&gt;
&lt;br /&gt;
using (StreamWriter fileWriter = new StreamWriter(@&amp;quot;filenamewithpath&amp;quot;, true))&lt;br /&gt;
{&lt;br /&gt;
    writer = XmlWriter.Create(fileWriter, settings);&lt;br /&gt;
	&lt;br /&gt;
    writer.WriteStartElement(&amp;quot;Order&amp;quot;);&lt;br /&gt;
    writer.WriteAttributeString(&amp;quot;OrderID&amp;quot;, txtOrderID.Text);&lt;br /&gt;
    writer.WriteAttributeString(&amp;quot;Date&amp;quot;, DateTime.Now.ToShortDateString());&lt;br /&gt;
    writer.WriteElementString(&amp;quot;Amount&amp;quot;, txtAmount.Text);&lt;br /&gt;
    writer.WriteEndElement();&lt;br /&gt;
&lt;br /&gt;
    writer.Flush();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Girish&amp;#39;s method would be required if you would like to insert the nodes at a particular tree hierarchy than just appending at the end.&lt;br /&gt;
Happy programming &lt;br /&gt;
Anton</description></item><item><title>Re: Append datas on xml file with xmlwriter class</title><link>http://forums.asp.net/thread/2359848.aspx</link><pubDate>Thu, 15 May 2008 12:50:38 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2359848</guid><dc:creator>esohier</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2359848.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=2359848</wfw:commentRss><description>&lt;p&gt;Hi and thanks for your answer.&lt;/p&gt;
&lt;p&gt;Can you give me a true example to do this?&amp;nbsp;More explicit to create XML node and append it?&lt;/p&gt;
&lt;p&gt;How can I convert my xmlwriter class?&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Append datas on xml file with xmlwriter class</title><link>http://forums.asp.net/thread/2359839.aspx</link><pubDate>Thu, 15 May 2008 12:44:37 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2359839</guid><dc:creator>Gery128</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2359839.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=2359839</wfw:commentRss><description>&lt;p&gt;Hi Eshohier,&lt;/p&gt;
&lt;p&gt;You can use XMLDocument class to load XML file already existing on server. for that first add the namespace &amp;quot;using System.Data.Xml;&amp;quot;&lt;/p&gt;
&lt;p&gt;Then create a new instance of XMLDocument like , XMLDocument doc = new XMLDocumen(); Then just load xml by saying doc.Load(&amp;quot;pass ur xml file path here&amp;quot;); and then you can create XMLNode and append it to the current xml. lastly you can save xml by saying doc.save(&amp;quot;pass ur xml file path&amp;quot;);&lt;/p&gt;
&lt;p&gt;if &lt;/p&gt;you</description></item><item><title>Re: Append datas on xml file with xmlwriter class</title><link>http://forums.asp.net/thread/2359838.aspx</link><pubDate>Thu, 15 May 2008 12:44:35 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2359838</guid><dc:creator>Gery128</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2359838.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=2359838</wfw:commentRss><description>&lt;p&gt;Hi Eshohier,&lt;/p&gt;
&lt;p&gt;You can use XMLDocument class to load XML file already existing on server. for that first add the namespace &amp;quot;using System.Data.Xml;&amp;quot;&lt;/p&gt;
&lt;p&gt;Then create a new instance of XMLDocument like , XMLDocument doc = new XMLDocumen(); Then just load xml by saying doc.Load(&amp;quot;pass ur xml file path here&amp;quot;); and then you can create XMLNode and append it to the current xml. lastly you can save xml by saying doc.save(&amp;quot;pass ur xml file path&amp;quot;);&lt;/p&gt;
&lt;p&gt;if &lt;/p&gt;</description></item><item><title>Re: Append datas on xml file with xmlwriter class</title><link>http://forums.asp.net/thread/2359837.aspx</link><pubDate>Thu, 15 May 2008 12:44:34 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2359837</guid><dc:creator>Gery128</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2359837.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=2359837</wfw:commentRss><description>&lt;p&gt;Hi Eshohier,&lt;/p&gt;
&lt;p&gt;You can use XMLDocument class to load XML file already existing on server. for that first add the namespace &amp;quot;using System.Data.Xml;&amp;quot;&lt;/p&gt;
&lt;p&gt;Then create a new instance of XMLDocument like , XMLDocument doc = new XMLDocumen(); Then just load xml by saying doc.Load(&amp;quot;pass ur xml file path here&amp;quot;); and then you can create XMLNode and append it to the current xml. lastly you can save xml by saying doc.save(&amp;quot;pass ur xml file path&amp;quot;);&lt;/p&gt;
&lt;p&gt;if &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Append datas on xml file with xmlwriter class</title><link>http://forums.asp.net/thread/2359736.aspx</link><pubDate>Thu, 15 May 2008 12:12:45 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2359736</guid><dc:creator>esohier</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2359736.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=2359736</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve create a xml file using xmlwriter class.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve a problem to append new data on this file, because the create method of xmlwriter overwrite the xml file.&lt;/p&gt;
&lt;p&gt;How can I append datas with xmlwriter without lost previous datas?&lt;/p&gt;
&lt;p&gt;Thanks by advance.&lt;/p&gt;</description></item></channel></rss>