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

Author Message
jgibbens

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 2/20/2008
  • Status: offline
Visual Basic 2005 newb in need of some XML write to file help Wednesday, February 20, 2008 3:10 AM (permalink)
0
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
 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    RE: Visual Basic 2005 newb in need of some XML write to file help Wednesday, February 20, 2008 3:16 AM (permalink)
    0
    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
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • 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
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9