Fields with same name in XML
Posted: Wed Feb 17, 2010 12:27 pm
Is there any way that we can read read xml file where tagnames coming with same name.i am able to read first XML and populating fields except updatedate fileds.here i want to ppopulate if dateSequence=0 then updateDate should go to firstdate and if dateSequence=1 then second updateDate should go to seconddate(Issue is i am getting updateDate twice)
here is my requirement
I/p
<?xml version="1.0" encoding="UTF-8"?>
<XML>
<product>
<number>123</number>
<color><blue></color>
<location>A</location>
<Dates>
<dateSequence>0</dateSequence>
<updateDate>2010-01-10</updateDate>
<dateSequence>1</dateSequence>
<updateDate>2007-01-10</updateDate>
</Dates>
</product>
</XML>
out put must be:
number color location firstdate seconddate
1 blue A 2010-01-10 2007-01-10
My Design flow is
Extsourcestage--->Xml input-->Transformer---->seqfile
The logic i have used in Tx is
If Lnk_XMLi_Parse_xml_Tfm.dateSequence=0 Then Lnk_XMLi_Parse_Payload_Tfm.updateDate Else "1800-01-01" =firstdate;
If Lnk_XMLi_Parse_xml_Tfm.dateSequence=1 Then Lnk_XMLi_Parse_Payload_Tfm.updateDate Else "1800-01-01"=seconddate;)
But the output i am able to populate is
number color location firstdate seconddate
1 blue A 2010-01-10
Thanks
Kris
here is my requirement
I/p
<?xml version="1.0" encoding="UTF-8"?>
<XML>
<product>
<number>123</number>
<color><blue></color>
<location>A</location>
<Dates>
<dateSequence>0</dateSequence>
<updateDate>2010-01-10</updateDate>
<dateSequence>1</dateSequence>
<updateDate>2007-01-10</updateDate>
</Dates>
</product>
</XML>
out put must be:
number color location firstdate seconddate
1 blue A 2010-01-10 2007-01-10
My Design flow is
Extsourcestage--->Xml input-->Transformer---->seqfile
The logic i have used in Tx is
If Lnk_XMLi_Parse_xml_Tfm.dateSequence=0 Then Lnk_XMLi_Parse_Payload_Tfm.updateDate Else "1800-01-01" =firstdate;
If Lnk_XMLi_Parse_xml_Tfm.dateSequence=1 Then Lnk_XMLi_Parse_Payload_Tfm.updateDate Else "1800-01-01"=seconddate;)
But the output i am able to populate is
number color location firstdate seconddate
1 blue A 2010-01-10
Thanks
Kris