XML Port problem with repeating Elements

Toddy_BoyToddy_Boy Member Posts: 231
I'm having a little trouble understanding XMLPorts. This is the output I'm getting;

3f98ovpg3dts.png

from this dataport

e2o28mjiucw0.png

However I don't want to see the Products element repeating, it should be

<Products>
<SerialNumber>1000<SerialNumber>
<SerialNumber>2000<SerialNumber>
<SerialNumber>3000<SerialNumber>
<SerialNumber>4000<SerialNumber>
</Products>

Can't see where I'm going wrong
Life is for enjoying ... if you find yourself frowning you're doing something wrong

Best Answer

Answers

  • kaspermoerchkaspermoerch Member Posts: 43
    edited 2016-10-04
    You can't achieve that with an XMLport.

    You can however get one of the following results:
    <Products>
        <SerialNumber SerialNo=""/>
        <SerialNumber SerialNo=""/>
        <SerialNumber SerialNo=""/>
        <SerialNumber SerialNo=""/>
    </Products>
    
    <Products>
        <SerialNumber>
            <SerialNo></SerialNo>
        </SerialNumber>
        <SerialNumber>
            <SerialNo></SerialNo>
        </SerialNumber>
        <SerialNumber>
            <SerialNo></SerialNo>
        </SerialNumber>
    </Products>
    

    In both cases the Products element is a Text node and the SerialNumber element loops the Serial No. Information table. In the first example SerialNo is an Attribute and in the second an Element.

    If neither of these formats suites you then you have to create the XML document by hand e.g. by using .NET.
Sign In or Register to comment.