gtx911
gtx911

Reputation: 1289

Mule - XML Array only reads one element

I have a XML payload that contains the following example:

<Example>
    <Brand>
        <Id>987S</Id>
        <logo>circle</logo>
        <Item>
            <Name>cologne1</Name>
            <Item>
                <Name>Bosque</Name>
            </Item>
        </Item>
        <Item>
            <Name>t-Shirt</Name>
        </Item>
    </Brand>
    <Brand>
        <Id>877823C</Id>
        <logo>circle</logo>
        <Item>
            <Name>t-Shirt2</Name>
            <Item>
                <Name>t-Shirt black</Name>
                <Item>
                    <Name>t-Shirt black with logo</Name>
                </Item>
            </Item>
        </Item>
    </Brand>
</Example>

I read the XML with DataWeave to transform the Example content to Array:

#[payload.Example.*Brand]

It returns a LinkedHashMap with two Objects. I use a for-each to loop and read each Brand object and the result is:

So, even if the brand object has two Items objects, it only returns one.

How could I solve this?

Upvotes: 0

Views: 206

Answers (1)

Salim Khan
Salim Khan

Reputation: 4303

You should be getting everything under Example tag.

enter image description here

Upvotes: 4

Related Questions