tags:

views:

21

answers:

0
<?xml version='1.0' encoding='utf-8' ?>
<All>
    <Customers> 

        <Customer>       
            <Name> Brisbane </Name> 
            <age> 18 </age>       
            <id> 1234 </id>
            <type> owner </type>                  
        </Customer> 

        <details>
        <address>  123,brisbane </address>
        <location> Indonacia </location>            
       </details>

       <contact> 
       <phone> 123456789 </phone>
       <fax>   12548976 </fax>             
       </contact>

    </Customers>

  <Customers> 
        <Customer>       
            <Name> manila</Name> 
            <age> 16 </age>       
            <id> 1200 </id>
            <type> seller</type>                  
        </Customer> 

        <details>
        <address>  rich street </address>
        <location> Fabia </location>            
       </details>

       <contact> 
       <phone> 987456321</phone>
       <fax>   23654897 </fax>             
       </contact>

    </Customers>

</All>

the above is my xml file. Based on the <type> i need to get all the node values of <customers></customers>. for example in the above example there are two types.

  1. owner
  2. seller.

so if i choose "owner" i need to get the details as follows

Brisbane
18
1234
123,brisbane
Indonacia
123456789
12548976

so if i choose "seller" i need to get the details as follows

manila
16
1200
rich street
Fabia
987456321
23654897

so how to do this. kindly show me some sample code for this