Page 1 of 1

XML Grouping

Posted: Wed Aug 18, 2010 9:47 am
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....

Posted: Wed Aug 18, 2010 2:29 pm
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

Posted: Wed Aug 18, 2010 8:33 pm
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

Posted: Wed Aug 18, 2010 11:28 pm
by ray.wurlod
Have you tried creating (and using) an XSD, as suggested?

Posted: Wed Aug 18, 2010 11:42 pm
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

Posted: Thu Aug 19, 2010 9:28 am
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...

Posted: Thu Sep 02, 2010 7:52 am
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