Results 1 to 3 of 3

Thread: Editing Multiple Nodes in a XML File - How?

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Posts
    258

    Editing Multiple Nodes in a XML File - How?

    Alright, I decided instead of Serialization or Access, I'm going be using XML files.

    Now, I have them properly adding and editing, but I see theirs a property .SelectNodes( )

    How do I use this ? I did a quick Google Search, couldn't find much. Here's the current Code I'm using to Edit my Document.

    vb Code:
    1. Public Sub EditClasses()
    2.         With frmClassEdit
    3.             Dim xmlDoc As New XmlDocument
    4.             xmlDoc.Load(Application.StartupPath & "\Data\" & .cmbClassSelection.SelectedItem.ToString & ".xml")
    5.  
    6.             Dim xmlnod As XmlNode
    7.             xmlnod = xmlDoc.DocumentElement.SelectSingleNode("Classes/ClassName")
    8.             xmlnod.InnerText = .txtClassName.Text
    9.             xmlnod = xmlDoc.DocumentElement.SelectSingleNode("Classes/ClassCode")
    10.             xmlnod.InnerText = .txtClassCode.Text
    11.             xmlnod = xmlDoc.DocumentElement.SelectSingleNode("Classes/ClassRoom")
    12.             xmlnod.InnerText = .txtClassRoom.Text
    13.             xmlnod = xmlDoc.DocumentElement.SelectSingleNode("Classes/Grade")
    14.             xmlnod.InnerText = .numGrade.Value
    15.  
    16.             xmlDoc.Save(Application.StartupPath & "\Data\" & .txtClassCode.Text & ".xml")
    17.             xmlDoc.RemoveAll()
    18.         End With
    19.     End Sub
    Last edited by Wesley008; Apr 2nd, 2009 at 03:10 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width