Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6140179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:05:02+00:00 2026-05-23T18:05:02+00:00

I am wondering how do you go about updating an XML string using XML

  • 0

I am wondering how do you go about updating an XML string using XML document…

I will be changing the values of attributes in an xmlDocument (this will be a large string)… Looking online I was a little confused about the proper way to do this… Here is a sample of what I am trying to do…

    //get the value at the key from the form collection
    var value = formCollection[key.ToString()];
    //lookup the specifc <node> in the xml file and match it to the key... should be equal to the path's array found in _EditTemplate values above...
    XmlNode xElm = xmlTemplate.SelectSingleNode(string.Format("//dataTemplateSpecification/templates/template/elements/element[@name=\"{0}\"]", key.ToString()));
                //get the value attribute va                    
    XmlAttribute tempAtt = xElm.Attributes["value"];// = formCollection[key.ToString()];
                //Attempt to set the attribute value to the correct value
    tempAtt.Value = value;// formCollection[key.ToString()];

Does that seem like a rational way to update an xml String? Remember, I don’t want to save this to a file. I want to update the string and go from there I need to do more processing…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:05:03+00:00Added an answer on May 23, 2026 at 6:05 pm

    If I just wanted to set an attribute value (without looking at the previous value), I’d use XmlElement.SetAttribute.

    (As an aside, if you’re using .NET 3.5 or higher, I would definitely look at LINQ to XML instead of the original DOM API.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering about the performance impact of copying very large php variables. For example
I'm wondering about MP3 decoding/encoding, and I was hoping to pull this off in
I'm just wondering about large projects - say an airlines reservation system, how many
I was always wondering about this seemingly utopic world of open source. Assuming the
I am updating this post with what I think I now know about getting
I have been wondering about this for a while. What if Magento has written
So, with all this about using UJS and RJS being removed from rails 3.1,
Wondering about using gzipped resources for my iOS app. The idea is to unzip
Wondering about the best way to turn a string like yyyymmdd into a string
I read about this Article I wondering about this part: try { //First try

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.