Zorac_da_mantis
asked on
Place textbox text into XML element
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.getEle mentsByTag Name("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
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.getEle
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ooh if you're using .NET replace n.text with n.InnerText
ASKER
Top answer
Thanks
Thanks for the quick response!!!
Thanks
Thanks for the quick response!!!