title: How to modify an xml attribute's value?
body: <p>How can i modify the value of an attribute within an xml loaded using Loadxml()?</p>
  
  <p>I'm trying to update the xml string stored in my db. For that, i used the following code:</p>
  
  <pre><code>XmlDocument doc = new XmlDocument();
          doc.LoadXml(project.ProjectData);
          XmlNodeList pNodes = doc.SelectNodes("project");
          foreach (XmlNode pNode in pNodes)
          {
              XmlAttribute lPDAttribute = pNode.Attributes["lastPubDate"];
              if (lPDAttribute != null)
              {
                  string currentValue = lPDAttribute.Value;
                  if (string.IsNullOrEmpty(currentValue))
                  {
                      lPDAttribute.Value = project.PublishDate.ToString();
                  }
              }
          }
  </code></pre>
  
  <p>What should i do to save the updated attribute within my current xml? Please help.</p>