This should be a simple problem to solve but I'm not good with code so I've come up stuck
I have an XML that i'm converting using the json node to extact vertain values using a function node.
I want to get just the type, cost and colour of each object and convert back to xml.
<?xml version="1.0" standalone="yes"?>
<Products>
<Product>
<Type>one</Type>
<Cost>2</Cost>
<Quantity>10</Quantity>
<Size>small</Size>
<Weight>heavy</Weight>
<Colour>red</Colour>
</Product>
<Product>
<Type>two</Type>
<Cost>5</Cost>
<Quantity>10</Quantity>
<Size>medium</Size>
<Weight>light</Weight>
<Colour>green</Colour>
</Product>
<Product>
<Type>three</Type>
<Cost>3</Cost>
<Quantity>10</Quantity>
<Size>small</Size>
<Weight>heavy</Weight>
<Colour>red</Colour>
</Product>
<Product>
<Type>four</Type>
<Cost>12</Cost>
<Quantity>10</Quantity>
<Size>large</Size>
<Weight>heavy</Weight>
<Colour>yellow</Colour>
</Product>
<Product>
<Type>five</Type>
<Cost>25</Cost>
<Quantity>10</Quantity>
<Size>small</Size>
<Weight>light</Weight>
<Colour>red</Colour>
</Product>
<Product>
<Type>six</Type>
<Cost>25</Cost>
<Quantity>18</Quantity>
<Size>medium</Size>
<Weight>light</Weight>
<Colour>blue</Colour>
</Product>
</Products>
I have a function which will give me the type and this is where I'm stuck, how to format my function to return type, cost and colour?
for (let i = 0; i < msg.payload.Products.Product.length; i++)
{
msg.payload.Products.Product[i] = [msg.payload.Products.Product[i].Type[0]];
}
return msg;
Thanks