1

We are using Xmlwriter object to create xml and using below code to write an attribute: xmlWriter.WriteAttributeString("UIVersion", GetWorkflowAssociationUIVersion(wfa, xmlWriter));

Now after this we execute some lines of code and based on some conditional code our requirement is to change the value of attribute "UIVersion" again. now we cannot use xmlWriter.WriteAttributeString("UIVersion", foldername) as it will create a new attribute. Any inputs on how can we update the attribute

Soheil Alizadeh
  • 2,936
  • 11
  • 29
  • 56
nina
  • 95
  • 3
  • 12
  • 2
    Possible duplicate of [Modify XML existing content in C#](https://stackoverflow.com/questions/2551307/modify-xml-existing-content-in-c-sharp) – dnickless Jul 19 '17 at 06:00
  • 1
    From the [documentation](https://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.aspx): `XmlWriter` *Represents a writer that provides a fast, non-cached, **forward-only** way to generate streams or files that contain XML data.* Since it's forward-only you can't rewind and rewrite the attribute you previously wrote. Instead, use one of XML editing APIs suggested in the answer linked by @dnickless. Or, just don't write the attribute until you know what you want to write. – dbc Jul 19 '17 at 06:05

0 Answers0