Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Myself1
Contributor III
Contributor III

Merge XML files with different shemas but with a common tag

Hi,

How to merge several XML files with different schemas but with a common sub-element which can be considered such as a key, "aid" into my example ?

Input files

XML File 1

----------

<?xml version="1.0" encoding="UTF-8"?>

<appointments>

 <appointment>

   <Field name="aid">27014</Field>

   <Field name="XA_SB_CUSTOMER"/>

   <Field name="XA_SECOND_DECODER_LOCATION"/>

   ...

   <Field name="XA_WO_SIGNATURE_QUOTE_NAME_ACCPT"/>

   <Field name="XA_ZUNNY_PARTNER_ID"/>

 </appointment>

 <appointment>

   <Field name="aid">28071</Field>

   <Field name="XA_SB_CUSTOMER"/>

   <Field name="XA_SECOND_DECODER_LOCATION"/>

  ...

   <Field name="XA_WO_SIGNATURE_QUOTE_NAME_ACCPT"/>

   <Field name="XA_ZUNNY_PARTNER_ID"/>

 </appointment>

 <appointment>

   <Field name="aid">28081</Field>

   <Field name="XA_SB_CUSTOMER"/>

   <Field name="XA_SECOND_DECODER_LOCATION"/>

   ...

   <Field name="XA_WO_SIGNATURE_QUOTE_NAME_ACCPT"/>

   <Field name="XA_ZUNNY_PARTNER_ID"/>

 </appointment>

 <appointment>

   ...

 </appointment>

</appointments>

XML File 2

----------

<?xml version="1.0" encoding="UTF-8"?>

<appointments>

 <appointment>

   <Field name="aid">27014</Field>

   <Field name="XA_TAP_BUILDING_LOCATION"/>

   <Field name="XA_TAP_BUILDING_LOCATION_COMMENT"/>

   ...

   <Field name="XA_SUSPEND_REASON"/>

   <Field name="XA_SUSPEND_REASON_COMMENT"/>

 </appointment>

 <appointment>

   <Field name="aid">28071</Field>

   <Field name="XA_TAP_BUILDING_LOCATION"/>

   <Field name="XA_TAP_BUILDING_LOCATION_COMMENT"/>

  ...

   <Field name="XA_SUSPEND_REASON"/>

   <Field name="XA_SUSPEND_REASON_COMMENT"/>

 </appointment>

 <appointment>

   <Field name="aid">28081</Field>

   <Field name="XA_TAP_BUILDING_LOCATION"/>

   <Field name="XA_TAP_BUILDING_LOCATION_COMMENT"/>

   ...

   <Field name="XA_SUSPEND_REASON"/>

   <Field name="XA_SUSPEND_REASON_COMMENT"/>

 </appointment>

 <appointment>

   ...

 </appointment>

</appointments>

XML File 3

----------

<?xml version="1.0" encoding="UTF-8"?>

<appointments>

 <appointment>

   <Field name="aid">27014</Field>

   <Field name="XA_WIFI_COVERAGE_CHECKED"/>

   <Field name="XA_WIFI_EXT_UC_MAT"/>

   ...

   <Field name="XA_SUB_LOT_INIT"/>

   <Field name="XA_SUB_LOT_END"/>

 </appointment>

 <appointment>

   <Field name="aid">28071</Field>

   <Field name="XA_WIFI_COVERAGE_CHECKED"/>

   <Field name="XA_WIFI_EXT_UC_MAT"/>

  ...

   <Field name="XA_SUB_LOT_INIT"/>

   <Field name="XA_SUB_LOT_END"/>

 </appointment>

 <appointment>

   <Field name="aid">28081</Field>

   <Field name="XA_WIFI_COVERAGE_CHECKED"/>

   <Field name="XA_WIFI_EXT_UC_MAT"/>

   ...

   <Field name="XA_SUB_LOT_INIT"/>

   <Field name="XA_SUB_LOT_END"/>

 </appointment>

 <appointment>

   ...

 </appointment>

</appointments>

Expected Output XML File

<?xml version="1.0" encoding="UTF-8"?>

<appointments>

 <appointment>

   <Field name="aid">27014</Field>

   <Field name="XA_WIFI_COVERAGE_CHECKED"/>

   <Field name="XA_WIFI_EXT_UC_MAT"/>

   <Field name="XA_TAP_BUILDING_LOCATION"/>

   <Field name="XA_TAP_BUILDING_LOCATION_COMMENT"/>

   <Field name="XA_SB_CUSTOMER"/>

   <Field name="XA_SECOND_DECODER_LOCATION"/>

   ...

   <Field name="XA_SUB_LOT_INIT"/>

   <Field name="XA_SUB_LOT_END"/>

   <Field name="XA_SUSPEND_REASON"/>

   <Field name="XA_SUSPEND_REASON_COMMENT"/>

   <Field name="XA_WO_SIGNATURE_QUOTE_NAME_ACCPT"/>

   <Field name="XA_ZUNNY_PARTNER_ID"/>

 </appointment>

 <appointment>

   <Field name="aid">28071</Field>

   <Field name="XA_WIFI_COVERAGE_CHECKED"/>

   <Field name="XA_WIFI_EXT_UC_MAT"/>

   <Field name="XA_TAP_BUILDING_LOCATION"/>

   <Field name="XA_TAP_BUILDING_LOCATION_COMMENT"/>

   <Field name="XA_SB_CUSTOMER"/>

   <Field name="XA_SECOND_DECODER_LOCATION"/>

  ...

   <Field name="XA_SUB_LOT_INIT"/>

   <Field name="XA_SUB_LOT_END"/>

   <Field name="XA_SUSPEND_REASON"/>

   <Field name="XA_SUSPEND_REASON_COMMENT"/>

   <Field name="XA_WO_SIGNATURE_QUOTE_NAME_ACCPT"/>

   <Field name="XA_ZUNNY_PARTNER_ID"/>

 </appointment>

 <appointment>

   <Field name="aid">28081</Field>

   <Field name="XA_WIFI_COVERAGE_CHECKED"/>

   <Field name="XA_WIFI_EXT_UC_MAT"/>

   <Field name="XA_TAP_BUILDING_LOCATION"/>

   <Field name="XA_TAP_BUILDING_LOCATION_COMMENT"/>

   <Field name="XA_SB_CUSTOMER"/>

   <Field name="XA_SECOND_DECODER_LOCATION"/>

   ...

   <Field name="XA_SUB_LOT_INIT"/>

   <Field name="XA_SUB_LOT_END"/>

   <Field name="XA_SUSPEND_REASON"/>

   <Field name="XA_SUSPEND_REASON_COMMENT"/>

   <Field name="XA_WO_SIGNATURE_QUOTE_NAME_ACCPT"/>

   <Field name="XA_ZUNNY_PARTNER_ID"/>

 </appointment>

 <appointment>

   ...

 </appointment>

</appointments>

Thanks.

Labels (3)
1 Reply
Anonymous
Not applicable

@JC JC​ , I'm afraid there is no a Talend component that can merge the XML files. You can check whether it can be achieved through Java code.

 

Regards

Shong