Return various attributes using XPATH

4

How can I return multiple attributes using the xpath language? For example of this xml:

<utilizador>
        <nome>Rui</nome>
        <contacto>91xxxxxxx</contacto>
        <localidade>Viseu</localidade>
        <cesto>
            <encomenda refidprod="rlg05" estado="enviado" data="13-01-2014"/>
            <encomenda refidprod="hifi02" estado="enviado" data="1-10-2014"/>
        </cesto>
        <cestohist>
            <encomendas refidprod="tv02" estado="entregue" data="29-11-2014"/>
        </cestohist>
<utilizador>

How do I return the values of the parcel attributes, both from the basket and the basket?

Cumpz

    
asked by anonymous 26.02.2015 / 19:18

1 answer

4

In the XML example, it would be //utilizador/cesto | //utilizador/cestohist to return any of the two attributes.

Explaining : Each of the //utilizador/cesto and //utilizador/cestohist returns only one attribute, the | operator is used to join the two results.

    
26.02.2015 / 19:22