Page 1 of 1

Generation of XML file

Posted: Tue Nov 13, 2007 3:12 pm
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.

Posted: Wed Nov 14, 2007 5:16 pm
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