Carriage Returns in XML

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
arrim1
Participant
Posts: 1
Joined: Thu Dec 11, 2003 10:39 am

Carriage Returns in XML

Post by arrim1 »

Hi,

When I try and produce an XML file using the XML output stage I get a carriage return before and after every piece of data. The tags indent correctly (although they don't seem to below) and the attributes are stored correctly.
Is there any way of prventing this?

What I currently get...

<enquiry>
<enquiry_id>
19873
</enquiry_id>
<name code="A">
350Z Email Subscription
</name>
</enquiry>

What I want...

<enquiry>
<enquiry_id>19873</enquiry_id>
<name code="A">350Z Email Subscription</name>
</enquiry>

thanks in advance,
Martin
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Umm...

You could post-process the generated XML code to remove all carriage returns other than those following a closing tag (or remove them all then place one after each closing tag).

Don't know how to do what you want with the XML Writer stage, but the above would be quite straightforward to do in DataStage BASIC.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Maharaj
Participant
Posts: 13
Joined: Tue Feb 03, 2004 3:50 pm

XML Carriage Return Issue

Post by Maharaj »

Hi

Iam facing the same issue in my XML written using the XML writer stage .
I want to remove all carriage returns other than those following a closing tag. How can I do that in DataStage BASIC.

Thanks in advance .
Maharaj
ray.wurlod wrote:Umm...

You could post-process the generated XML code to remove all carriage returns other than those following a closing tag (or remove them all then place one after each closing tag).

Don't know how to do what you want with the XML Writer stage, but the above would be quite straightforward to do in DataStage BASIC.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Pseudo code.

Code: Select all

Open input file for sequential access.
Open output file for sequential access.
Loop
Read next line.
   Loop
      Search for closing tag.  A closing tag matches the pattern "'</'0X'>'".
         (A line containing a closing tag matches the pattern "0X'</'0X'>'0X".)
      Remove the following character(s) if it's a CR (or CR/LF Windows).
   While (closing tag found) Repeat
   Write line to output file.
Until End-Of-File
Repeat
Close output file.
Close input file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Maharaj
Participant
Posts: 13
Joined: Tue Feb 03, 2004 3:50 pm

Re: XML Carriage Return Issue

Post by Maharaj »

Maharaj wrote:Hi

Thanks a lot for it . :)


Iam facing the same issue in my XML written using the XML writer stage .
I want to remove all carriage returns other than those following a closing tag. How can I do that in DataStage BASIC.

Thanks in advance .
Maharaj
ray.wurlod wrote:Umm...

You could post-process the generated XML code to remove all carriage returns other than those following a closing tag (or remove them all then place one after each closing tag).

Don't know how to do what you want with the XML Writer stage, but the above would be quite straightforward to do in DataStage BASIC.
guidomarcel1
Participant
Posts: 10
Joined: Fri Feb 20, 2004 4:25 am

Re: XML Carriage Return Issue

Post by guidomarcel1 »

Hi,
what is with the option "Multiple Line Output" in the XML Writer stage? This option turned to "0" will avoid carriage returns

Regards
Guido
bunu1977
Participant
Posts: 35
Joined: Thu Oct 16, 2003 4:46 am

Re: XML Carriage Return Issue

Post by bunu1977 »

In datastage 7x do we have option like "Multiple Line Output" set to 0

Or any one is having the basic code to replace the carraige return

Thanks
guidomarcel1 wrote:Hi,
what is with the option "Multiple Line Output" in the XML Writer stage? This option turned to "0" will avoid carriage returns

Regards
Guido
Dilip Das
Post Reply