Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Visual Basic 2005 newb in need of some XML write to file help

 
Logged in as: Guest
arrSession:exec spGetSession 2,7,56907
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [General Forum] >> Other Programming/Scripting Languages >> Visual Basic 2005 newb in need of some XML write to file help
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Visual Basic 2005 newb in need of some XML write to fil... - 2/20/2008 2:10:28 AM   
  jgibbens

 

Posts: 1
Score: 0
Joined: 2/20/2008
Status: offline
Original message moved by ebgreen
Reason : Moved to proper forum
Visual Basic 2005 newb in need of some XML write to file help



First, thank you for even looking at my question.

I am using VB 2005 and I have a question about XML.


what I want to do is:
1. keep adding to this file with out over writing it
2. be able to change stuff the XML without overwriting the rest of the file



This is the XML I have:





    <presentation courseName="" lesson="">
    <modules>
      <module>
        <title hide=""></title>
        <imageLoc url=""></imageLoc>
        <bullets>
          <bullet></bullet>
        </bullets>
        <bdyhtmlText>worker</bdyhtmlText>
        <checkPoint hide="">
          <question></question>
          <answers>
            <answer resp=""></answer>
            <correctAnswer></correctAnswer>
          </answers>
        </checkPoint>
      </module>
    </modules>
    </presentation>




I have this code that writes the initial XML:





    Public Class Form1
     
      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

      End Sub

      Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click

          Dim setting As Xml.XmlWriterSettings = New Xml.XmlWriterSettings()
          setting.Indent = True
          setting.NewLineOnAttributes = True
          Dim xw As Xml.XmlWriter = Xml.XmlWriter.Create("C:\Documents and Settings\gibbensj\Desktop\new writer test feb 20 2008\WindowsApplication1\books.xml", setting)
          xw.WriteStartDocument()
          xw.WriteStartElement("presentation")
          xw.WriteStartElement("modules")
          xw.WriteStartElement("module")
          xw.WriteElementString("title", titleBx.Text)
          xw.WriteElementString("imageLoc", slideBx.Text)
          xw.WriteStartElement("bullets")
          xw.WriteElementString("bullet", "")
          xw.WriteEndElement()
          xw.WriteElementString("bdyhtmlText", bodyBx.Text)
          xw.WriteStartElement("checkpoint")
          xw.WriteEndElement()
          xw.WriteEndElement()
          xw.WriteEndElement()
          xw.WriteEndDocument()
          xw.Flush()
          xw.Close()
      End Sub
    End Class




How would I go about this?


I am loving VB but it is very difficult. My hats off to those of you who are productive with it. Thank you for any help, in advance.

-J
 
 
Post #: 1
 
 RE: Visual Basic 2005 newb in need of some XML write to... - 2/20/2008 2:16:42 AM   
  ebgreen


Posts: 4411
Score: 29
Joined: 7/12/2005
Status: offline
You should be aware that VBScript (which is what this site is focused on) is vastly different from VB .Net. You may happen across someone here that knows the answer off the top of their head, but you would be more likely to get an answer at a VB .Net site.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to jgibbens)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [General Forum] >> Other Programming/Scripting Languages >> Visual Basic 2005 newb in need of some XML write to file help Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts