Hi guys this is the code for printing and updating the inner text of node in a xml file through vb.net code which i used update my xml file name as content.xml
****************************
content.xml
*************************
<?xml version="1.0" encoding="utf-8"?>
<main>
<node1 id="1">my old text</node1>
</main>
******************************
Public Function shw()
Dim strxmlpath As String = Server.MapPath("content.xml")
Dim doc As New XmlDocument
doc.Load(strxmlpath)
Dim elem As XmlNode = doc.DocumentElement.FirstChild
Response.Write(elem.InnerText)
doc.Save(strxmlpath)
End Function
Public Function updt()
Dim strxmlpath As String = Server.MapPath("content.xml")
Dim doc As New XmlDocument
doc.Load(strxmlpath)
Dim node As XmlNode = doc.DocumentElement.FirstChild
node.InnerText = " enter your new text"
doc.Save(strxmlpath)
End Function
****************************
content.xml
*************************
<?xml version="1.0" encoding="utf-8"?>
<main>
<node1 id="1">my old text</node1>
</main>
******************************
This function is to print inner text of a xml node
Public Function shw()
Dim strxmlpath As String = Server.MapPath("content.xml")
Dim doc As New XmlDocument
doc.Load(strxmlpath)
Dim elem As XmlNode = doc.DocumentElement.FirstChild
Response.Write(elem.InnerText)
doc.Save(strxmlpath)
End Function
This function is to update inner text of a xml file
Public Function updt()
Dim strxmlpath As String = Server.MapPath("content.xml")
Dim doc As New XmlDocument
doc.Load(strxmlpath)
Dim node As XmlNode = doc.DocumentElement.FirstChild
node.InnerText = " enter your new text"
doc.Save(strxmlpath)
End Function