Hello All,
I have a problem to combine all the attributes which have different terms into one.
Job design : oracle connector - > Transformer - > xml output stage
Obtained target data from the Parallel job :
<Attributes>
<Attributes rid="6662c0f2.ee6a64fe.l24jqigsp.covj0co.drb6tl.jfop11sr6p7jecls0aoe4" name="casd">
<parentAttributes identity="cas" rid="6662c0f2.ee6a64fe.l24jqigsg.9nl3ohv.2tvhev.vc087jfjmmm1gu529g2hj"/>
<referencedTerms>
<termRef identity="term1" rid="6662c0f2.e1b1ec6c.l24jqh6sb.s9vjv3o.59nikr.piqs04lp4q4gt5ue6q8m4"/>
</referencedTerms>
</Attributes>
<Attributes rid="6662c0f2.ee6a64fe.l24jqigsp.covj0co.drb6tl.jfop11sr6p7jecls0aoe4" name="casd">
<parentAttributes identity="cas" rid="6662c0f2.ee6a64fe.l24jqigsg.9nl3ohv.2tvhev.vc087jfjmmm1gu529g2hj"/>
<referencedTerms>
<termRef identity="Term5_null" rid="6662c0f2.e1b1ec6c.l24jqh6te.l4jtt5b.136ghj.cmcgds8veqt83oea3594f"/>
</referencedTerms>
</Attributes>
<Attributes>
Requried output =
<Attributes>
<Attributes rid="6662c0f2.ee6a64fe.l24jqigsp.covj0co.drb6tl.jfop11sr6p7jecls0aoe4" name="casd">
<parentAttributes identity="cas" rid="6662c0f2.ee6a64fe.l24jqigsg.9nl3ohv.2tvhev.vc087jfjmmm1gu529g2hj"/>
<referencedTerms>
<termRef identity="term1" rid="6662c0f2.e1b1ec6c.l24jqh6sb.s9vjv3o.59nikr.piqs04lp4q4gt5ue6q8m4"/>
<termRef identity="Term5_null" rid="6662c0f2.e1b1ec6c.l24jqh6te.l4jtt5b.136ghj.cmcgds8veqt83oea3594f"/>
</referencedTerms>
</Attributes>
Let me know how to get the desired output.
Thanks in advance
Unable to combine repetition attribues in xml file
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 117
- Joined: Wed Feb 06, 2013 9:24 am
- Location: Chennai,TN, India
Hard to say, but this looks like a the scenario we've seen happen when there is only one innermost element of the repeating node. As a test, see what happens if you add several dummy columns.... create them upstream in a transformer, and give them a unique counter value (use a Stage variable or @INROWNUM).
Then give them xpath that looks like:
/Attributes/parentAttributes/referencedTerms/dummy1/text()
[so that they are at the same "level" as termRef]
Make this new column the key INSTEAD of what you had before.
Hopefully you will only need one, but go up to three additional ones, just in case. Let us know if that impacts the behavior of this inner node...then we can talk about removing it.
Ernie
Then give them xpath that looks like:
/Attributes/parentAttributes/referencedTerms/dummy1/text()
[so that they are at the same "level" as termRef]
Make this new column the key INSTEAD of what you had before.
Hopefully you will only need one, but go up to three additional ones, just in case. Let us know if that impacts the behavior of this inner node...then we can talk about removing it.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
-
- Participant
- Posts: 117
- Joined: Wed Feb 06, 2013 9:24 am
- Location: Chennai,TN, India
Congrats!
For future readers who might find this via search, there are multiple stages that can be used to "write" xml documents. The xmlOutput Stage, which is available in releases 7.x and above, and the XML Stage, which arrived in 8.5. Both Stages can be used, but the XML Stage, which is newer, is far more powerful in features and capabilities, especially where complex multi-node structures are concerned. The XML Stage, however, requires at least "some" working knowledge of xsd's, and requires that you "have" an xsd to work from.
Glad it worked out!
Ernie
For future readers who might find this via search, there are multiple stages that can be used to "write" xml documents. The xmlOutput Stage, which is available in releases 7.x and above, and the XML Stage, which arrived in 8.5. Both Stages can be used, but the XML Stage, which is newer, is far more powerful in features and capabilities, especially where complex multi-node structures are concerned. The XML Stage, however, requires at least "some" working knowledge of xsd's, and requires that you "have" an xsd to work from.
Glad it worked out!
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>