Page 1 of 1

Carriage Returns in XML

Posted: Tue Jan 27, 2004 10:19 am
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

Posted: Tue Jan 27, 2004 10:05 pm
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.

XML Carriage Return Issue

Posted: Wed Feb 04, 2004 6:53 am
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.

Posted: Wed Feb 04, 2004 3:20 pm
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.

Re: XML Carriage Return Issue

Posted: Thu Feb 05, 2004 3:46 pm
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.

Re: XML Carriage Return Issue

Posted: Wed Feb 25, 2004 3:57 am
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

Re: XML Carriage Return Issue

Posted: Mon Jan 30, 2006 10:37 am
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