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
Carriage Returns in XML
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
XML Carriage Return Issue
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
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Re: XML Carriage Return Issue
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.
-
- Participant
- Posts: 10
- Joined: Fri Feb 20, 2004 4:25 am
Re: XML Carriage Return Issue
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
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
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
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