Linq to xml update attribute value




















Viewed 4k times. Improve this question. Massey Massey 3 3 gold badges 19 19 silver badges 41 41 bronze badges. Note that your XPath query is greedy. That's because the "Value" attribute is present at the third level of the Node element. Thanks — Massey. Add a comment. Active Oldest Votes. You can accomplish the update with your method by adding one more inner loop: foreach XmlNode checkedNode in node.

Descendants "Node". Attributes "Checked". Attribute "Checked". Improve this answer. The following example shows how to retrieve the value of an attribute if the attribute is in a namespace. For more information, see Namespaces overview. Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Skip to main content. This browser is no longer supported. Download Microsoft Edge More info.

Contents Exit focus mode. Please rate your experience Yes No. Text, comboBox2. Improve this question. Jinesh Sam. Jinesh Sam Jinesh Sam 3 3 silver badges 20 20 bronze badges.

What do you want to update in this xml file? Add a comment. Active Oldest Votes. Load ".. Element "XandYPosition". Elements "column". FirstOrDefault ; updatenode. Attribute "Name". Attribute "X".



0コメント

  • 1000 / 1000