?
Solved

Place textbox text into XML element

Posted on 2004-11-10
3
Medium Priority
?
318 Views
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>  
     </freetexts>
    </freetext>
   </content>
   </page>

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*

Next

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
0
Comment
Question by:Zorac_da_mantis
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
plq earned 2000 total points
ID: 12544014
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
0
 
LVL 8

Expert Comment

by:plq
ID: 12544020
Ooh if you're using .NET replace n.text with n.InnerText
0
 

Author Comment

by:Zorac_da_mantis
ID: 12552783
Top answer
Thanks

Thanks for the quick response!!!

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Progress
Loops Section Overview

840 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