I have XML stored in my database.

XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<orders>
   <singleOrder no="1" date="2015-01-22">
      <customer id="1" />
      <products>
         <product>
            <productId>1</productId>
            <quantity>3</quantity>
         </product>
      </products>
   </singleOrder>
   <singleOrder no="4" date="2015-02-27">
      <customer id="1" />
      <products>
         <product>
            <productId>3</productId>
            <quantity>2</quantity>
         </product>
         <product>
            <productId>4</productId>
            <quantity>4</quantity>
         </product>
      </products>
   </singleOrder>
   <singleOrder no="2" date="2015-01-25">
      <customer id="3" />
      <products>
         <product>
            <productId>4</productId>
            <quantity>5</quantity>
         </product>
      </products>
   </singleOrder>
   <singleOrder no="3" date="2015-02-01">
      <customer id="4" />
      <products>
         <product>
            <productId>1</productId>
            <quantity>8</quantity>
         </product>
         <product>
            <productId>3</productId>
            <quantity>20</quantity>
         </product>
      </products>
   </singleOrder>
</orders>



I want to get from it for all product: customer/@id, singleOrder/@no,
productId, quantity, singleOrder/@date, so the output will look like this:


customerIdorderIdproductIdquantitydate11132015-01-2214322015-02-271444
2015-02-2732452015-01-2543182015-02-01433202015-02-01

Do you know how to do that?


Thank you,
Grzegorz

Reply via email to