Note that there are some explanatory texts on larger screens.

plurals
  1. PORemove a node that doesn't have attribute
    text
    copied!<p>I've using asp.net, and I've got an xml file provided from a third party website. I want it to be scraped so it only display the first main node. My problem is there is no attribute on any of the node. How can I manage to remove them? </p> <p>The following is the xml. </p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;offers&gt; &lt;class_offer&gt; &lt;name&gt;&lt;![CDATA[Learn to surf and save 52% at Muriwai Surf School]]&gt;&lt;/name&gt; &lt;url&gt;http://domain.co.nz/wai-surf-school-just-29&lt;/url&gt; &lt;location&gt;Auckland&lt;/location&gt; &lt;/class_offer&gt; &lt;class_offer&gt; &lt;name&gt;&lt;![CDATA[$35 for a 30 minute luxury Slipper Bath experience for TWO]]&gt;&lt;/name&gt; &lt;url&gt;http://domain.co.nz/uxury-slipper-bath-experience-for-two&lt;/url&gt; &lt;location&gt;Auckland&lt;/location&gt; &lt;/class_offer&gt; &lt;class_offer&gt; &lt;name&gt;&lt;![CDATA[Save 52% at Te Aroha Mineral Spas]]&gt;&lt;/name&gt; &lt;url&gt;http://domain.co.nz/rience-for-two-PLUS-massage&lt;/url&gt; &lt;location&gt;Auckland&lt;/location&gt; &lt;/class_offer&gt; &lt;/offers&gt; </code></pre> <p>And I want it to be this below,only keeps the first (the last 2 <code>"&lt;class_offer&gt;"</code> has been removed, and <code>"&lt;location&gt;"</code> has been removed)</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;offers&gt; &lt;class_offer&gt; &lt;name&gt;&lt;![CDATA[Learn to surf and save 52% at Muriwai Surf School]]&gt;&lt;/name&gt; &lt;url&gt;http://domain.co.nz/wai-surf-school-just-29&lt;/url&gt; &lt;/class_offer&gt; &lt;/offers&gt; </code></pre> <p>I really have no idea what to do to remove without the attribute in the node. If anyone could help that'll be great! Thanks in advance. </p>
 

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