I try to find out to export data from a table to xml file. Here is the situation:

```
Table1
contractID     subcontractid     ContractName     ContractType
123                              John             Electrical
123            1                 John             Comercial
123            2                 John             Resident
134                              Jim              Plumping
134            1                 Jim              Comercial
134            2                 Jim              Resindent

```

I'd like to have an xml file output as following

```
<contracts>
  <contract contractid = 123 contractname = john, contracttype = Electrical>
    <subcontract subcontractid = 1, contractname = John, contractType = Comercial />
    <subcontract subcontractid = 2, contractname = John, contractType = Resident />
  </contract>
  <contract contractid = 134 contractname = Jim, contracttype = Plumping>
    <subcontract subcontractid = 1, contractname = Jim, contractType = Comercial />
    <subcontract subcontractid = 2, contractname = Jim, contractType = Resident />
  </contract>
</contracts>

```