Generation of XML file

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
sonia jacob
Participant
Posts: 122
Joined: Mon Jul 05, 2004 1:33 pm
Location: MA

Generation of XML file

Post by sonia jacob »

Hi,

Per my requirement I need to generate and XML file in the following format. As you can see TAG1 and TAG2 are non-repeating and TAG3 is repeating.

<TAG1>
<TAG2></TAG2>
<TAG3></TAG3>
<TAG3></TAG3>
<TAG3></TAG3>
<TAG3></TAG3>
</TAG1>

In my XML output stage I mapped as follows

Column1 : /tag/tag1
Column2 : /tag/tag2
Column3 : /tag/tag3

But this mapping generates the file as folows. And you can see TAG2 is being repeated. :cry:
<TAG1>
<TAG2></TAG2>
<TAG3></TAG3>
<TAG2></TAG2>
<TAG3></TAG3>
<TAG2></TAG2>
<TAG3></TAG3>
<TAG2></TAG2>
<TAG3></TAG3>
</TAG1>

How can I make TAG2 as non-repeating. I am a novice as far as XML is concerned. Any help would greatly be greatly appreciated.
Regards
Sonia Jacob
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

More typically you will see a repeating set of nodes, such as TAG3, within their own higher level construct (like you might see in other languages such as COBOL or even in a WSDL document with "ArrayOfTAG3"). XMLPack tends to prefer seeing things this way...not sure if you are restricted to your output format, but just for kicks, try the following and see if it works...then we can discuss other options from there.

Make your Description properties look like:

/TAG/TAG1/text()
/TAG/TAG2/text()
/TAG/allTAG3s/TAG3/text()

...and let us know what happens.

I will assume you have sorted data coming in for your 3 columns, with columns 1 and 2 being the same for large groups.

Again, this may not be your goal, but getting this figured out will help you understand the stage, and also help us craft a solution.

Ernie
Post Reply