XML-import MySQL - Casus lente 2018 (2)
Versie door Jeroen Strompf (overleg | bijdragen) op 21 apr 2018 om 13:00
Dit artikel borduurt voort op XML-import MySQL - Casus lente 2018, met een specifiek probleem.
Voorbeeld-data
<?xml version="1.0"?> <Items> <item> <item_code>01</item_code> <Discount number="1"> <Quantity>50</Quantity> <Value>1.3</Value> </Discount> <Discount number="2"> <Quantity>100</Quantity> <Value>0.95</Value> </Discount> <Discount number="3"> <Quantity>0</Quantity> <Value>0</Value> </Discount> </Item> <item> <item_code>02</item_code> <Discount number="1"> <Quantity>10</Quantity> <Value>2.7</Value> </Discount> <Discount number="2"> <Quantity>50</Quantity> <Value>1.3</Value> </Discount> <Discount number="3"> <Quantity>100</Quantity> <Value>0.95</Value> </Discount> </Item> </Items>
Het probleem
Een parent-node bevat een attribuut:
- Dat attribuut moet toegevoegd worden aan de parent-node zelf
- Dat attribuut moet ook toegevoegd worden aan de namen van de twee onderliggende subnodes.