xml repeating groups problem

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
boxtoby
Premium Member
Premium Member
Posts: 138
Joined: Mon Mar 13, 2006 5:11 pm
Location: UK

xml repeating groups problem

Post by boxtoby »

I am having a problem with repeating groups. I have read the various posts and the best practises document but I still cannot get it to work.

I have reduced the exercise to a simple example whereby Friend_Name and Friend_Number are the repeating group for the name.

The Friend_Number is defined as the key to identify the repeating group.

However, I get flat xml output, ie one Name for each Friend_Name

Any help would be greatly appreciated.

Bob.


SOURCE DATA

Pr_Key,Name,Friend_Number,Friend_Name,Status
001, Bob, 1, Friend 1, Open
001, Bob, 2, Friend 2, Closed
002, Dave, 3, Mate 1, Unknown
002, Dave, 4, Mate 2, Suspended

XSD:

/Friends/Owner/Pr_Key/text()
/Friends/Owner/Name/text()
/Friends/Owner/Contacts/Friend_Number/text()
/Friends/Owner/Contacts/Friend_Name/text()
/Friends/Owner/Status/text()


OUTPUT:

<Friends>
<Owner>
<Pr_Key>
1
</Pr_Key>
<Name>
Bob
</Name>
<Contacts>
<Friend_Number>
1
</Friend_Number>
<Friend_Name>
Friend 1
</Friend_Name>
</Contacts>
<Status>
Open
</Status>
</Owner>
<Owner>
<Pr_Key>
1
</Pr_Key>
<Name>
Bob
</Name>
<Contacts>
<Friend_Number>
2
</Friend_Number>
<Friend_Name>
Friend 2
</Friend_Name>
</Contacts>
<Status>
Closed
</Status>
</Owner>
<Owner>
<Pr_Key>
2
</Pr_Key>
<Name>
Dave
.
.
.
.
.
.
Bob Oxtoby
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It usually helps to post both the output you want versus the output you get, clearly labelling which is which.

I mean, helps us mere mortals, Ernie probably needs no such. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
boxtoby
Premium Member
Premium Member
Posts: 138
Joined: Mon Mar 13, 2006 5:11 pm
Location: UK

Post by boxtoby »

Dear Mortals,

Sorry if my first post wasn't clear, hope this helps!

The output should look something like this,

<Friends>
<Owner>
<Pr_Key>
1
</Pr_Key>
<Name>
Bob
</Name>
<Contacts>
<Friend_Number>
1
</Friend_Number>
<Friend_Name>
Friend 1
</Friend_Name>
<Friend_Number>
2
</Friend_Number>
<Friend_Name>
Friend 2
</Friend_Name>
</Contacts>
<Status>
Closed
</Status>
</Owner>
<Owner>
<Pr_Key>
2
</Pr_Key>
<Name>
Dave
Bob Oxtoby
Post Reply