Skip to content

Instantly share code, notes, and snippets.

@putridparrot
Created March 13, 2015 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save putridparrot/0425fc9f8d88ee7ffac1 to your computer and use it in GitHub Desktop.
Save putridparrot/0425fc9f8d88ee7ffac1 to your computer and use it in GitHub Desktop.
Change text within an xml document
// takes a string representing the XML and allows us to find a node and change the inner text, also shows
// how to set-up namespaces (note: For simplicity there's No error handling in this sample)
let changeValue xmlData =
let nameTable = NameTable()
let namespaceManager = XmlNamespaceManager(nameTable)
namespaceManager.AddNamespace("soap", "http://www.w3.org/2003/05/soap-envelope")
let xml = XmlDocument()
xml.LoadXml xmlData
let current = xml.SelectSingleNode("//soap:Envelope/soap:Body/someElement", namespaceManager)
current.InnerText <- "NEW TEXT"
xml.OuterXml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment