XML Grouping

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kandulayk
Participant
Posts: 2
Joined: Wed Aug 18, 2010 9:23 am
Location: Banglore

XML Grouping

Post by kandulayk »

Hi Guru's,

I am trying to group on one element while generationg xml chunk.
below is the example:
1)
<AB>
<A1>
<a1>sdff</a1>
<a2> dssf</a2>
.
.
</A1>
</AB>

Want to group on the <a2> tag , if <a2> value is changing then this should be in another <A> tag as below
<AB>
<A1>
<a1>sdff</a1>
<a2> dssf</a2>
.
.
</A1>
</AB>
<AB>
<A1>
<a1>sdff</a1>
<a2> ljkj</a2>
.
.
</A1>
</AB>
Thanking in advance....
Yogendra
arunpramanik
Participant
Posts: 63
Joined: Fri Jun 22, 2007 7:27 am
Location: Kolkata

Post by arunpramanik »

welcome to dsxchange

First try to create a XSD, then import it in the XML output stage
You can easily create this xsd from a sample xml file using xmlspy
kandulayk
Participant
Posts: 2
Joined: Wed Aug 18, 2010 9:23 am
Location: Banglore

Post by kandulayk »

Hi Arun,

am able to create XML with out groping, as shown in 1( even <a2> is changing also displaying in the same tag <AB>

need to group second example.

let me know ...views
Yogendra
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Have you tried creating (and using) an XSD, as suggested?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

An xsd isn't the issue here, assuming that the xml is already being created successfully.

Tell us more about the rows coming in....how are they sorted, what do the values look like? How are they grouped, and also share the "xpath" on the input link of your xmlOutput Stage [the values in the description column for each column].

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

Which is the column you have as 'Key' in your XML output stage. If you want to create a XML record everytime your a2 value changes, keep it as 'Key' in your XML stage.

Also do remember that you can only define one repetition element...
Arun
way246
Participant
Posts: 7
Joined: Wed Sep 01, 2010 9:06 am
Location: Europe

Post by way246 »

Your input data will be like this

a1 a2
===============
sdff dssf
sdff ljkj

xpath
/AB/A1/a1/txt()
/AB/A1/a2/txt()

key will be a2

or try Transformation settings - trigger coulm option in XML Output stage
Post Reply