Place textbox text into XML element

Posted on 2004-11-10
Last Modified: 2010-04-17
Hi all

I am in desperate need of assitance. I have a VB6 program that splits text out of XML documents using FileSystemObjet and iot does all that I need, however when it comes time to place the ammended text back into the relevant XML elements I am getting very stuck. The file structure is as follows. This is extremely urget for me. If you can provide a .NET example that is also ok.

<?xml version="1.0" encoding="utf-8" ?>
- <page>
- <content>
-  <freetext>
-   <freetexts>
      <html> *Ammended Text to be overwritten from VB Text box*</html>  

THe code I have so far is as follows:

Private Sub PopulateXml()

Dim xml As New msXML.DOMDocument
Dim nList As msXML.IXMLDOMNodeList
Dim n As msXML.IXMLDOMNode
Dim tmpStr As String

xml.Load (FullPath)

Set nList = xml.documentElement.getElementsByTagName("html")

For Each n In nList

      *code to append the existing html element with text from Text1.txt*    
      *something like n.appendChild(tmpStr) im not sure*


End Sub

I have looked at many examples on the net using DOM objects but I just cant understand how to assign the actual text string to a node and then append the node.
Please could someone explain how to do this.

Many thanks in advance
Question by:Zorac_da_mantis
    LVL 8

    Accepted Solution

    n.text = textbox.text

    Thats it.

    if its a sub node

    n.selectSingleNode("html").text = textbox.text

    Then at the end do

    xml.Save FullPath
    LVL 8

    Expert Comment

    Ooh if you're using .NET replace n.text with n.InnerText

    Author Comment

    Top answer

    Thanks for the quick response!!!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Suggested Solutions

    Title # Comments Views Activity
    NotAlone Challenge 20 65
    scoresClump  challenge 31 83
    wordsWithout 49 63
    File.WriteAllLines problem at random C# ASP.NET 6 34
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now