Script To Convert Xml File To Csv

Hi,

I need a script that will convert xml files to csv format.

The budget for this is $10 to $30.

The xml files always have the same data format, and csv file always has the same column headers – only the records change for each file.

Each tag in the xml file needs to be the column header in the csv file.

Also change any of the records with the text in CAPITALS to just First Letter Capital Of Each Word Only.

In column headers, replace _ with a space ” “. (shown in example below)

There will be some code for characters like & for the “&” sign – can you change it so the “&” sign shows in the csv. here is an example line of code from the xml file with that data:
<NATURE_OF_BUSINESS>RETAIL MEN’S & WOMEN’S CLOTHING AND ACCESSORIES</NATURE_OF_BUSINESS>
In the csv, the data for that line would be: Retail Men’s & Women’s Clothing And Accessories
The column header would be: Nature of Business

Size of xml file: 500kb to 50Mb

Sample of 2 records from xml file:

<G_FORMS>
<ORGANISATION_ID2>110404782</ORGANISATION_ID2>
<BUSNME_ID2>2166647</BUSNME_ID2>
<NAME>INTIME ON LAKE ST</NAME>
<ORGANISATION_NUM>BN21666477</ORGANISATION_NUM>
<REGISTRATION_START_DATE>17-JUN-10</REGISTRATION_START_DATE>
<COMMENCEMENT_DATE>14-JUN-10</COMMENCEMENT_DATE>
<NATURE_OF_BUSINESS>RETAIL MEN’S & WOMEN’S CLOTHING AND ACCESSORIES</NATURE_OF_BUSINESS>
<BQ1_RECEIVED>16-JUN-10</BQ1_RECEIVED>
<BQ1_FORM>BQ1A</BQ1_FORM>
<BQ1_EFFECTIVE></BQ1_EFFECTIVE>
<LIST_G_ADDRESS_ID>
</LIST_G_ADDRESS_ID>
<LIST_G_ROLE_ID>
<G_ROLE_ID>
<PROP_ROLE>7137026</PROP_ROLE>
<PROP_REPRESENTEE>JUDITH ANNE BEARD</PROP_REPRESENTEE>
<PROP_ADDRESS>2500548</PROP_ADDRESS>
<PROP_START>14-JUN-10</PROP_START>
<PROP_ORG>110404782</PROP_ORG>
<F_ADDRESS_PROP>0</F_ADDRESS_PROP>
<P_ADDRESS_PROPRIETOR>Started 14/06/2010 JUDITH ANNE BEARD at 33 MEGAN CLOSE FRESHWATER QLD 4870 </P_ADDRESS_PROPRIETOR>
</G_ROLE_ID>
</LIST_G_ROLE_ID>
<LIST_G_RES_ROLE>
</LIST_G_RES_ROLE>
<LIST_G_PPOB_ORGANISATION_ID>
<G_PPOB_ORGANISATION_ID>
<PPOB_ORGANISATION_ID>110404782</PPOB_ORGANISATION_ID>
<PPOB_ADDRESS_ID>13785941</PPOB_ADDRESS_ID>
<PPOB_START_DATE>14-JUN-10</PPOB_START_DATE>
<PPOB_END_DATE></PPOB_END_DATE>
<P_PPOB_ADDRESS>Started 14/06/2010 at 84 LAKE STREET CAIRNS QLD 4870 AUSTRALIA</P_PPOB_ADDRESS>
<F_PPOB_ADDRESS>0</F_PPOB_ADDRESS>
</G_PPOB_ORGANISATION_ID>
</LIST_G_PPOB_ORGANISATION_ID>
<LIST_G_EMAIL_ORGANISATION_ID>
</LIST_G_EMAIL_ORGANISATION_ID>
<LIST_G_ANZSIC_ACTIVITY_CODE>
</LIST_G_ANZSIC_ACTIVITY_CODE>
<CF_G_FORMS>1</CF_G_FORMS>
<P_NAME>BN21666477 INTIME ON LAKE ST</P_NAME>
<F_NAME>0</F_NAME>
</G_FORMS>
<G_FORMS>
<ORGANISATION_ID2>110404758</ORGANISATION_ID2>
<BUSNME_ID2>2166648</BUSNME_ID2>
<NAME>SMELLY MELLY DELI</NAME>
<ORGANISATION_NUM>BN21666489</ORGANISATION_NUM>
<REGISTRATION_START_DATE>17-JUN-10</REGISTRATION_START_DATE>
<COMMENCEMENT_DATE>02-JUL-10</COMMENCEMENT_DATE>
<NATURE_OF_BUSINESS>SELLING CHEESE AND ANTIPASTO</NATURE_OF_BUSINESS>
<BQ1_RECEIVED>16-JUN-10</BQ1_RECEIVED>
<BQ1_FORM>BQ1A</BQ1_FORM>
<BQ1_EFFECTIVE></BQ1_EFFECTIVE>
<LIST_G_ADDRESS_ID>
<G_ADDRESS_ID>
<OPOB_ADDRESS_ID>13785954</OPOB_ADDRESS_ID>
<OPOB_ORGANISATION_ID>110404758</OPOB_ORGANISATION_ID>
<OPOB_START_DATE>17-JUN-10</OPOB_START_DATE>
<F_OPOB_ADDRESS>0</F_OPOB_ADDRESS>
<P_OPOB_ADDRESS>Started 17/06/2010 at 57-89 GRAFTON STREET CAIRNS QLD 4870 AUSTRALIA</P_OPOB_ADDRESS>
</G_ADDRESS_ID>
</LIST_G_ADDRESS_ID>
<LIST_G_ROLE_ID>
<G_ROLE_ID>
<PROP_ROLE>7137028</PROP_ROLE>
<PROP_REPRESENTEE>MELISSA JODY MCTAVISH</PROP_REPRESENTEE>
<PROP_ADDRESS>13785950</PROP_ADDRESS>
<PROP_START>17-JUN-10</PROP_START>
<PROP_ORG>110404758</PROP_ORG>
<F_ADDRESS_PROP>0</F_ADDRESS_PROP>
<P_ADDRESS_PROPRIETOR>Started 17/06/2010 MELISSA JODY MCTAVISH at 454 SEVERIN STREET MANUNDA QLD 4870 AUSTRALIA</P_ADDRESS_PROPRIETOR>
</G_ROLE_ID>
</LIST_G_ROLE_ID>
<LIST_G_RES_ROLE>
</LIST_G_RES_ROLE>
<LIST_G_PPOB_ORGANISATION_ID>
<G_PPOB_ORGANISATION_ID>
<PPOB_ORGANISATION_ID>110404758</PPOB_ORGANISATION_ID>
<PPOB_ADDRESS_ID>13785951</PPOB_ADDRESS_ID>
<PPOB_START_DATE>17-JUN-10</PPOB_START_DATE>
<PPOB_END_DATE></PPOB_END_DATE>
<P_PPOB_ADDRESS>Started 17/06/2010 at 454 SEVERIN STREET MANUNDA QLD 4870 AUSTRALIA</P_PPOB_ADDRESS>
<F_PPOB_ADDRESS>0</F_PPOB_ADDRESS>
</G_PPOB_ORGANISATION_ID>
</LIST_G_PPOB_ORGANISATION_ID>
<LIST_G_EMAIL_ORGANISATION_ID>
</LIST_G_EMAIL_ORGANISATION_ID>
<LIST_G_ANZSIC_ACTIVITY_CODE>
</LIST_G_ANZSIC_ACTIVITY_CODE>
<CF_G_FORMS>1</CF_G_FORMS>
<P_NAME>BN21666489 SMELLY MELLY DELI</P_NAME>
<F_NAME>0</F_NAME>
</G_FORMS>

Leave a Reply

Your email address will not be published. Required fields are marked *