Solved

Updating a single attribute element in an XML file

Posted on 2006-11-04
2
161 Views
Last Modified: 2013-11-19
Hi there, given the below xml file

how can I amend xxxxx?

<?xml version="1.0" encoding="utf-8" ?>
<values>
      <setting attribute = "user_last_logged_on" value="xxxxx"></setting>
</values>
0
Comment
Question by:DavidGreenfield
2 Comments
 

Author Comment

by:DavidGreenfield
ID: 17874681
I have changed the xml format to :

<?xml version="1.0" encoding="utf-8" ?>
<values>
      <setting attribute = "user_last_logged_on">
            <user>xxxxx</user>
      </setting>
</values>

and the code so far is:

        Dim persist_xml_nodelist As XmlNodeList
        Dim persist_xml_doc = New XmlDocument()
        Dim persist_xml_node As XmlNode

        persist_xml_doc.Load("persisted.xml")
        persist_xml_nodelist = persist_xml_doc.SelectNodes("/values/setting[@attribute='user_last_logged_on']/user")
        For Each persist_xml_node In persist_xml_nodelist
            persist_xml_node.InnerText = cbo_Username.Text
        Next
        persist_xml_doc.Save("persisted.xml")
        Debug.Print(persist_xml_doc.InnerXml())

the debug print shows the xml updated correctly.  But the xml when I go to view it - it hasn't changed.  So something seems to be going wrong on saving :oS

Thanks in advance
0
 
LVL 7

Accepted Solution

by:
Mohamed Zedan earned 500 total points
ID: 17875979
Maybe the persisted.xml is opened or is readonly .... try deleting this file and use the save method with a full path to the file like ("C:\Persisted.xml")
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

823 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