<p>Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding. 
Idea is to edit a dynamic XML (structure known to the developer during coding), using the WPF UI.</p>

<p>Has anyone found a way to load a dynamic xml string (for example load it from a file during runtime), then use that xml string as the XmlDataprovider source? </p>

<p>Code snippets would be great.</p>

<p>Update: To make it more clear,
Let's say I want to load an xml string I received from a web service call. I know the structure of the xml. So I databind it to WPF UI controls on the WPF Window. How to make this work? All the samples over the web, define the whole XML inside the XAML code in the XmlDataProvider node. This is not what I am looking for. I want to use a xml string in the codebehind to be databound to the UI controls. </p>

[{'answer_id': 60398, 'author': 'Mauro', 'author_id': 2208, 'author_profile': 'https://Stackoverflow.com/users/2208', 'pm_score': 1, 'selected': False, 'text': "<p>using your webservice get your XML and create an XML Document from it, You can then set the Source of your xmlDataProvider to the XMLDocument you got from the service.</p>\n\n<p>I'm not at a pc with visual studio to test it but it should be possible for you to do this.</p>\n\n<p>The steps are as you mentioned in your question:</p>\n\n<pre>\n1. Get XML from webservice\n2. Convert XML String to XML Document\n3. Set the XMLDataProvider.Document value to your XML Document\n4. Bind that to your controls\n</pre>\n"}, {'answer_id': 395358, 'author': 'Paul Osterhout', 'author_id': 30976, 'author_profile': 'https://Stackoverflow.com/users/30976', 'pm_score': 3, 'selected': True, 'text': '<p>Here is some code I used to load a XML file from disk and bind it to a TreeView. I removed some of the normal tests for conciseness. The XML in the example is an OPML file.</p>\n\n<pre><code>XmlDataProvider provider = new XmlDataProvider();\n\nif (provider != null)\n{\n  System.Xml.XmlDocument doc = new System.Xml.XmlDocument();\n  doc.Load(fileName);\n  provider.Document = doc;\n  provider.XPath = "/opml/body/outline";\n  FeedListTreeView.DataContext = provider;\n}\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/60259', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1747/']