Could anyone give me a really short example of how to read nodes with domdocuments in vb.net?
and also how to write values to the node? plz??? =/
Printable View
Could anyone give me a really short example of how to read nodes with domdocuments in vb.net?
and also how to write values to the node? plz??? =/
well seems like I dont need that much help now after all, still im using webservices to alter the attribute of an xmlfile the code Im using looks like this...
<WebMethod()> Public Function setattribute(ByVal value As String) As String
Try
Dim xmlDoc As XmlDocument = New XmlDocument()
xmlDoc.Load(Server.MapPath(".") & "\file.xml")
Dim xNode As Xml.XmlNode = xmlDoc.DocumentElement.SelectSingleNode("/customer")
xNode.Attributes("name").Value = value
Return xNode.Attributes("name").Value
Catch
End Try
End Function
well it all works fine except for one thing, the xmlfile never get saved? Ive tried with xmlDoc.save(Server.MapPath(".") & "\file.xml")
but then I get some error, what am I doing wrong?
well seems like I dont need that much help now after all, still im using webservices to alter the attribute of an xmlfile the code Im using looks like this...
<WebMethod()> Public Function setattribute(ByVal value As String) As String
Try
Dim xmlDoc As XmlDocument = New XmlDocument()
xmlDoc.Load(Server.MapPath(".") & "\file.xml")
Dim xNode As Xml.XmlNode = xmlDoc.DocumentElement.SelectSingleNode("/customer")
xNode.Attributes("name").Value = value
Return xNode.Attributes("name").Value
Catch
End Try
End Function
well it all works fine except for one thing, the xmlfile never get saved? Ive tried with xmlDoc.save(Server.MapPath(".") & "\file.xml")
but then I get some error, what am I doing wrong?