I have the following XML file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dictionaryEntry type="CM_Vserver">
<uuid>27bfb32f-baa1-4571-abb5-c644c132ceea</uuid>
<object-attributes>
<object-attribute type="String" naturalKey="false" name="admin_state">
<description>some text</description>
</object-attribute>
</object-attributes>
<object-references>
<object-reference refCol="cluster_id" naturalKey="true" name="cluster">
<type>49f5f09e-dcae-4922-98aa-0b4a58f27fda</type>
<description>some text</description>
</object-reference>
</object-references>
</dictionaryEntry>
and I would like to transform it into the following XML:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dictionaryEntry type="CM_Vserver">
<uuid>27bfb32f-baa1-4571-abb5-c644c132ceea</uuid>
<dictionary-entry-properties>
<dictionary-entry-property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="objectAttribute" attributeType="String" name="admin_state" naturalKey="false">
<uuid>9ccbbd60-0e62-4ae7-b158-e6825441f987</uuid>
<description>some text</description>
</dictionary-entry-property>
<dictionary-entry-property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="objectReference" referredColumn="cluster_id" name="cluster" naturalKey="true">
<uuid>afa8c22d-5af9-424e-af6d-106ad96dadbd</uuid>
<referenceType>49f5f09e-dcae-4922-98aa-0b4a58f27fda</referenceType>
<description>some text</description>
</dictionary-entry-property>
</dictionary-entry-properties>
</dictionaryEntry>
Note that I need to do the following changes:
- Rename object-attribute into dictionary-entry-property
- Rename object-reference into dictionary-entry-property
- Rename object-references/object-reference/type into referenceType
- Combine ex object-references and ex object-references in single node called dictionary-entry-properties
- Generate UUID for each object-references
Thanks in advance.