Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to appens nodes using XPATH
    text
    copied!<p>Hi everyone I'm using XPATH with XML.SelectNodes() to extract dome data from an XML file, I wish this data to be in certain order, the XML file is like this:</p> <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt; &lt;ConvenioAladi&gt; &lt;Operaciones&gt; &lt;Operacion Prioridad='Alta' /&gt; &lt;Operacion Prioridad='Media' /&gt; &lt;Operacion Prioridad='Alta' /&gt; &lt;Operacion Prioridad='Baja' /&gt; &lt;Operacion Prioridad='Baja' /&gt; &lt;Operacion Prioridad='Media' /&gt; &lt;/Operaciones&gt; &lt;/ConvenioAladi&gt; </code></pre> <p>And wish to obtain an XML like this:</p> <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt; &lt;ConvenioAladi&gt; &lt;Operaciones&gt; &lt;Operacion Prioridad='Alta' /&gt; &lt;Operacion Prioridad='Alta' /&gt; &lt;Operacion Prioridad='Media' /&gt; &lt;Operacion Prioridad='Media' /&gt; &lt;Operacion Prioridad='Baja' /&gt; &lt;Operacion Prioridad='Baja' /&gt; &lt;/Operaciones&gt; &lt;/ConvenioAladi&gt; </code></pre> <p>I'm capable of obtaining one of the Prioridad attributes at any moment by giving the XPATH:</p> <p><strong>'/ConvenioAladi/Operaciones/Operacion[@Prioridad='Alta']'</strong>,</p> <p>but if I try something like this: <strong>'/ConvenioAladi/Operaciones/Operacion[@Prioridad='Alta' or @Prioridad='Media' or @Prioridad='Baja' ]'</strong> </p> <p>Or: <strong>'/ConvenioAladi/Operaciones/Operacion[@Prioridad='Alta'] | /ConvenioAladi/Operaciones/Operacion[@Prioridad='Media'] | /ConvenioAladi/Operaciones/Operacion[@Prioridad='Baja']'</strong> </p> <p>I always get the original XML back, is there anyway of achieving what I mentioned before?. Thanks</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