Results 1 to 3 of 3

Thread: Dom documents?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2001
    Posts
    30

    Unhappy Dom documents?

    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??? =/

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Nov 2001
    Posts
    30

    Hmm?

    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?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2001
    Posts
    30

    Hmm?

    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width