I would like to add a node based on , but the problem is the categories are in a separate file and moreover I would like to loop to find all based on .
Let me show an example:
category.xml:
<ROOT>
<GROUPITEM>
<G_ID>1368</G_ID>
<GROUP>Phone</GROUP>
<PARENT>0</PARENT>
</GROUPITEM>
<GROUPITEM>
<G_ID>1194</G_ID>
<GROUP>Apple</GROUP>
<PARENT>1368</PARENT>
</GROUPITEM>
<GROUPITEM>
<G_ID>1195</G_ID>
<GROUP>2019</GROUP>
<PARENT>1194</PARENT>
</GROUPITEM>
</ROOT>
item.xml:
<ROOT>
<SHOPITEM>
<PRODUCT_ID>96555</PRODUCT_ID>
<GROUP_ID>1195</GROUP_ID>
<PRODUCT_NAME>Apple iPhone 8 Plus</PRODUCT_NAME>
</SHOPITEM>
</ROOT>
Example output:
<ROOT>
<SHOPITEM>
<PRODUCT_ID>96555</PRODUCT_ID>
<GROUP_ID>1195</GROUP_ID>
<PRODUCT_NAME>Apple iPhone 8 Plus</PRODUCT_NAME>
<CATEGORY>Phone | Apple | 2019</CATEGORY>
</SHOPITEM>
</ROOT>
In simple words I am looking for a way to create node (in item.xml) and add here value ( from category.xml) based on (item.xml): search in category.xml for the same -> if found, add it -> search more based on (if success add separator + value) -> loop.