Customer Portal

Issue with Xml Reader

Comments 3

  • Avatar
    Pedro Vazquez Rosario
    0
    Comment actions Permalink
    Hi,

    That is the expected behavior for the XMLReader the reason being is since Entity2 is ambiguous CloverETL can’t determine which element to choose from. When you define a Context tag the element shouldn’t be ambiguous, you should specify to the exact element you want to read from. In this case the second mapping approach is the best option, but I would recommend that you use a single xpath expression:

    xpath=”/Dataset/Entity2/Entity21”


    I would also recommend that you use the XMLExtract component, the reason being it’s easier to use and safer in terms of out of memory issues.
  • Avatar
    madan_clover3
    0
    Comment actions Permalink
    Thanks for explanation. I have tried Xml Extract as well. Problem with Xml Extract(SAX way) is we cannot map one source element to multiple target elements. In such case only last mapped element is getting data. (only fld3, fld4 is getting data in below case)

    <Mappings>
    <Mapping element="Dataset">
    <Mapping element="Entity2">
    <Mapping cloverFields="fld1;fld2;" element="Entity21" outPort="1" xmlFields="{}attribute211;{}field211;"/>
    <Mapping cloverFields="fld3;fld4;" element="Entity21" outPort="2" xmlFields="{}attribute211;{}field211;"/>
    </Mapping>
    </Mapping>
    </Mappings>

    Any better approach with above case, suggestions please.

    Thank you.
  • Avatar
    Pedro Vazquez Rosario
    0
    Comment actions Permalink
    Hi,

    Unfortunately, you can’t map the same element to two different output ports. I would recommend that you extract the field first and then use SimpleCopy or Reformat to map the source elements to multiple target elements.

    Best Regards,

Please sign in to leave a comment.