Created
March 13, 2015 10:58
-
-
Save putridparrot/0425fc9f8d88ee7ffac1 to your computer and use it in GitHub Desktop.
Change text within an xml document
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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