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
.
.
.
.
.
.
xml repeating groups problem
Moderators: chulett, rschirm, roy
xml repeating groups problem
Bob Oxtoby
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
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