Customer Portal

Problem creating mapping structure for XMLWriter

Comments 4

  • Avatar
    avackova
    0
    Comment actions Permalink
    Hello,
    if you don't need to join records from different input ports use StructureWriter instead of XMLWriter.
  • Avatar
    pgargdd
    0
    Comment actions Permalink
    Hi Agata,

    Thanks for your quick reply.
    I have tried using StructureWriter as well and using this component I am not able to generate a valid XML file.
    I have set mapping for the body mask for generating xml file in above format as:

    <Row>
    <Item_Number>
    <ID>$field4</ID>
    </Item_Number>
    <GTIN_Number code="$field2"/>
    <Mill_Code>$field5</Mill_Code>
    <Mill_Description>
    <ID>$field1</ID>
    </Mill_Description>
    <Style_Number>
    <Style>
    <ManufactureName name="$field3">
    <ID>$field6</ID>
    </ManufactureName>
    </Style>
    </Style_Number>
    </Row>


    As in case of xml, header and footer won't be required , so I didn't set footer mask and header mask for the same.

    The invalid generated XML file structure is:

    <Row>
    <Item_Number>
    <ID>345</ID>
    </Item_Number>
    <GTIN_Number code="1234"/>
    <Mill_Code>345</Mill_Code>
    <Mill_Description>
    <ID>345</ID>
    </Mill_Description>
    <Style_Number>
    <Style>
    <ManufactureName name="234dfsd4">
    <ID>345</ID>
    </ManufactureName>
    </Style>
    </Style_Number>
    </Row>
    <Row>
    <Item_Number>
    <ID>sdfd3443</ID>
    </Item_Number>
    <GTIN_Number code="345"/>
    <Mill_Code>field5</Mill_Code>
    <Mill_Description>
    <ID>3432</ID>
    </Mill_Description>
    <Style_Number>
    <Style>
    <ManufactureName name="wer3fd">
    <ID>fs2343</ID>
    </ManufactureName>
    </Style>
    </Style_Number>
    </Row>


    The Rows which is root node is not present in the XML generated file.

    Also I would like to know how to set the namespaces by using StructureWriter for XML files.

    Thanks
    Pushpendra
  • Avatar
    avackova
    0
    Comment actions Permalink
    Set static header:
    <?xml version="1.0" encoding="UTF-8"?>
    <Rows>
    and footer:
    </Rows>

    Namespaces can't be used with StructureWriter.
  • Avatar
    jcuendet
    0
    Comment actions Permalink
    Is it possible to map multiple inputs for the body part?

Please sign in to leave a comment.