p***@halcyontek.com
2013-05-16 09:48:32 UTC
I have to create XML from Excel selected columns. My Excel selected columns are as follows
My issue here is: if same tag with different attributes exists, they are not created in XML file.
Column Star XML Path Star Tag TC1-ECIN --------------------------------------------------------------------------------
Process:DataArea:Credit:IndividualApp:Address qualifier="HomeAdd" AddLine ABC
Process:DataArea:Credit:IndividualApp:Address qualifier="HomeAdd" AddLine XYZ
Process:DataArea:Credit:IndividualApp:Address qualifier="Billing" AddLine MNO
Process:DataArea:Credit:IndividualApp:Address qualifier="Billing" AddLine PQR
Process:DataArea:Credit:IndividualApp:Address qualifier="Garage" AddLine 123
Process:DataArea:Credit:IndividualApp:Address qualifier="Garage" AddLine 789
Required output should be as follows:
<Process>
<DataArea>
<Credit>
<IndividualApp>
<Address qualifier="HomeAddress">
<AddressLine>ABC</AddressLine>
<AddressLine>XYZ</AddressLine>
</Address>
<Address qualifier="Billing">
<AddressLine>MNO</AddressLine>
<AddressLine>PQR</AddressLine>
</Address>
<Address qualifier="Garage">
<AddressLine>123</AddressLine>
<AddressLine>789</AddressLine>
</Address>
</IndividualApp>
</Credit>
</DataArea>
</Process>
</Address>
So far I have coded is creating the XML as below and skipping <Address qualifier="Billing"> and <Address qualifier="Garage">
<Process>
<DataArea>
<Credit>
<IndividualApp>
<Address qualifier="HomeAddress">
<AddressLine>ABC</AddressLine>
<AddressLine>XYZ</AddressLine>
</Address>
</IndividualApp>
</Credit>
</DataArea>
</Process>
</Address>
My code is lengthy to post here since I have coded
1. Excel to read in Java
2. Finding Excel column index numbers and reading the contents
3. Splitting Excel column value as
<Process>
<DataArea>
<Credit>
<IndividualApp>
<Address qualifier="HomeAdd">
<AddLine>ABC</AddLine>
</Address>
</IndividualApp>
</Credit>
</DataArea>
</Process>
4. setting levels to create the tags(root, parent, child, value,....
I have posted my issue in one of the Java social sites where I have placed my code. please refer this URL, and d help me
http://stackoverflow.com/questions/16581916/unable-to-create-xml-attribute-name-multiple-times-with-different-values
My issue here is: if same tag with different attributes exists, they are not created in XML file.
Column Star XML Path Star Tag TC1-ECIN --------------------------------------------------------------------------------
Process:DataArea:Credit:IndividualApp:Address qualifier="HomeAdd" AddLine ABC
Process:DataArea:Credit:IndividualApp:Address qualifier="HomeAdd" AddLine XYZ
Process:DataArea:Credit:IndividualApp:Address qualifier="Billing" AddLine MNO
Process:DataArea:Credit:IndividualApp:Address qualifier="Billing" AddLine PQR
Process:DataArea:Credit:IndividualApp:Address qualifier="Garage" AddLine 123
Process:DataArea:Credit:IndividualApp:Address qualifier="Garage" AddLine 789
Required output should be as follows:
<Process>
<DataArea>
<Credit>
<IndividualApp>
<Address qualifier="HomeAddress">
<AddressLine>ABC</AddressLine>
<AddressLine>XYZ</AddressLine>
</Address>
<Address qualifier="Billing">
<AddressLine>MNO</AddressLine>
<AddressLine>PQR</AddressLine>
</Address>
<Address qualifier="Garage">
<AddressLine>123</AddressLine>
<AddressLine>789</AddressLine>
</Address>
</IndividualApp>
</Credit>
</DataArea>
</Process>
</Address>
So far I have coded is creating the XML as below and skipping <Address qualifier="Billing"> and <Address qualifier="Garage">
<Process>
<DataArea>
<Credit>
<IndividualApp>
<Address qualifier="HomeAddress">
<AddressLine>ABC</AddressLine>
<AddressLine>XYZ</AddressLine>
</Address>
</IndividualApp>
</Credit>
</DataArea>
</Process>
</Address>
My code is lengthy to post here since I have coded
1. Excel to read in Java
2. Finding Excel column index numbers and reading the contents
3. Splitting Excel column value as
<Process>
<DataArea>
<Credit>
<IndividualApp>
<Address qualifier="HomeAdd">
<AddLine>ABC</AddLine>
</Address>
</IndividualApp>
</Credit>
</DataArea>
</Process>
4. setting levels to create the tags(root, parent, child, value,....
I have posted my issue in one of the Java social sites where I have placed my code. please refer this URL, and d help me
http://stackoverflow.com/questions/16581916/unable-to-create-xml-attribute-name-multiple-times-with-different-values