I am trying to import XML file with products and categories to Magento.
The problem is, that the attributes like Category, Colour, Size etc. are defined as codes and the code specification is at the end of XML file as < codebook >.
I am looking for solution with Python how to replace codes with attribute names from < codebook >
here is an example:
original XML:
<pricelist>
<item>
<category>
<item code="1250" l1="0010" />
<item code="0610" l1="0010" />
</category>
</item>
</pricelist>
<codebook>
<category>
<item code="0010" parent="">Catalogue 2015</item>
<item code="0600" parent="0010">Office</item>
<item code="1200" parent="0010">Time and temperature measuring</item>
<item code="1210" parent="1200">Watches and watch sets</item>
<item code="1250" parent="1200">desktop watches, alarms</item>
<item code="0610" parent="0600">office table stuff</item>
</category>
</codebook>
</body>
</pricelist>
desired output XML:
<pricelist>
<item>
<category>
<item>Catalogue 2015 | Time and temperature measuring | desktop watches, alarms</item>
<item>Catalogue 2015 | Office | office table stuff</item>
</category>
</item>
</pricelist>
I would appreciate any help, thank you.