New Message on dotNET User Group Hyd

appending xml node using VB.NET

Reply
  Reply to Sender   Recommend Message 1 in Discussion
From: rajender123

I have one problem in appending the child in XML using VB.NET.
I have one xml file  like this
<SOLUTION>
<Project Name="Presentatx" location="C:\Documents and Settings\Administrator\My Documents\authorGen Projects\Presentatx.agn" dateofbuild="12/4/2004" />
</Project>
</solution>
Now next time if the user is making seond project, I want to append this xml file and just want to include the
project tag with all the details of second project.I have tried also but the problem i am getting is that i am  not able
to append the xml file . the new project tag is coming after the solution  tag "</solution>" at the end.
hers is the code which i am using for appending the xml file.
Pls tell me how will i solve this so that teh second  project tag will come after the first project
tag.
 
 

 Dim test As String
        test =  "solution.xml"
        If File.Exists(test) Then
 
            Dim fileOut As New FileStream(test, FileMode.Append, FileAccess.Write)
 
            Dim closer As New StreamWriter(fileOut)
            Dim writer2 As New XmlTextWriter(closer)

   writer2.WriteStartElement(String.Empty, "Project", String.Empty)
            writer2.WriteStartAttribute(String.Empty, "Name", String.Empty)
            writer2.WriteString(presInfo.title)
            writer2.WriteEndAttribute()
            writer2.WriteStartAttribute(String.Empty, "location", String.Empty)
            writer2.WriteString(path & ".agn")
            writer2.WriteEndAttribute()
            writer2.WriteStartAttribute(String.Empty, "dateofbuild", String.Empty)
            writer2.WriteString(gen1)
            writer2.WriteEndAttribute()
 writer2.WriteEndElement()
 

            closer.Write(vbCrLf + "</Project>" + vbCrLf)
          
   
          
            closer.Flush()
end if
 
 

View other groups in this category.

Click here!
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to