Note that there are some explanatory texts on larger screens.

plurals
  1. PODeleting node from string with xml structure
    text
    copied!<p>I have an string parameter with xml content in it. Basically the string have an <code>XML</code> inside.</p> <pre><code>string S = funcThatReturnsXML (parameters); </code></pre> <p><code>S</code> have the next text: </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;tagA&gt; &lt;tagB&gt; &lt;tagBB&gt; .. . . &lt;/tagBB&gt; . . &lt;/tagB&gt; &lt;tagC&gt; .. .. . &lt;/tagC&gt; &lt;/tagA&gt; </code></pre> <p>The <code>funcThatReturnsXML (parameters)</code> creates an <code>XmlDocument</code> object but the return it as a <code>string</code>, I cant change this function, to much stuff works with it.</p> <p>Tried to create XmlDocument objetc but the <code>SelectSingleNode</code> return null.</p> <pre><code> XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(S); XmlNode root = xmlDoc.SelectSingleNode("tagB"); </code></pre> <p>How can I delete from string <code>S</code> (not XML Object) specific node, for example <code>&lt;tagB&gt;</code></p> <p><strong>EDIT</strong>: this is the XML I tested with:</p> <pre><code> &lt;?xml version="1.0" ?&gt; - &lt;Request xmlns:xsi="http://www.mysite.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; - &lt;info xmlns="http://www.mysite.com"&gt; &lt;RequestTR&gt;54&lt;/RequestTR&gt; &lt;time&gt;2013-12-22&lt;/time&gt; &lt;/info&gt; - &lt;Parameters xmlns="http://www.mysite.com"&gt; &lt;id&gt;3&lt;/id&gt; &lt;name&gt;2&lt;/name&gt; &lt;/Parameters&gt; &lt;title&gt;Request&lt;/title&gt; &lt;/Request&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload