Edit XML File

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BiT

    #1

    Edit XML File

    Hello

    I Know how to create and add elements to xml file with XmlTextWriter, here
    is code for example:
    Dim textWriter As XmlTextWriter = New XmlTextWriter(" table.xml", Nothing)

    ' Opens the document

    textWriter.Writ eStartDocument( )

    ' Write comments

    textWriter.Writ eComment("Datab ase")

    ' Write first element

    textWriter.Writ eStartElement(" R_DataBase")

    textWriter.Writ eString("test")

    textWriter.Writ eEndElement()



    ' Ends the document.

    textWriter.Writ eEndDocument()

    ' close writer

    textWriter.Clos e()



    I Would like to know if there's way to edit xml file i mean to open the file
    and then to add or remove elements from it. beacuse right now my program
    make a new xml file everytime i need to save the file

  • Martin Honnen

    #2
    Re: Edit XML File

    BiT wrote:
    I Would like to know if there's way to edit xml file i mean to open the
    file and then to add or remove elements from it. beacuse right now my
    program make a new xml file everytime i need to save the file
    You can use System.Xml.XmlD ocument to load the XML document into a DOM
    tree model where you are then able to add/delete/manipulate nodes and
    save the tree model back to a file.

    --

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

    Comment

    Working...