XML CRLF error

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
pavanns
Participant
Posts: 27
Joined: Wed Sep 28, 2005 8:00 pm
Location: ca

XML CRLF error

Post by pavanns »

Hi
when i am trying to load a simple file into a xml and try to view the file in a visual studio, i run into the following error:

the data is CRLF erroired and looks like

<Tag>
Data

instead of </Tag>Data<Tag/>

Any idea of how to rectify this on PX?
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

CRLF's, in a tools that understands xml, are treated as "noise".... so while "pretty" formatting is interesting, it is not required. I'm surprised that studio doesn't recognize it....is the suffix of the file .xml ? This is similar to what you'd see if you opened it in notepad vs IE. DataStage will put some CRLF's in, but why bother...it's only wasted bytes.

<tag>

Data
</tag>

is the same as

<tag>Data</tag>

is the same as

<tag>Data
</tag>

Look at the XML in IE.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Maybe it's objecting to CRLF because you're on a UNIX platform and CRLF is not the line terminator. Most XML parsers would still recognize and be able to ignore CRLF, but the one you get with the XML stages has manifested other weird behaviours in the past, so who knows? Can you try pre-processing the file (perhaps with tr) to change all \r\n to just \n?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pavanns
Participant
Posts: 27
Joined: Wed Sep 28, 2005 8:00 pm
Location: ca

Post by pavanns »

hi,
the end user has an issue and has to see the data in <tag><data><tag which processes their application correctly.. i tried changing the format on xml o/p stage to UNIX & alos to DOs but still the same result..

pls advice
pavan
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Turn off / disable the 'Generate formatted output' option. The way that DataStage formats XML output is... let's leave it at 'different'. So turn it off and if for some odd reason your 'end user' still doesn't like it, you'll need to find an external tool that will 'pretty print' it for you before you send it on its way.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Push back. It's legitimate XML, no matter what the "pretty" format is. What are they absorbing it with? Their tool ought to accept it.

Alaternatively, you or they could write a style sheet very easily for display purposes or to do a final revision..... or.....depending on how many tags you have and how large the xml is, you could probably run the string thru a Server transformer and use UV/Basic to remove/add CRLFs where you need them. UV/Basic has some of the best string functions around.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

All true. I've had people that didn't *like* the way DataStage formatted the output but they could certainly process it. And the only reason we 'needed' to pretty some was for the people on the other end, not the parser - as noted, it could care less.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply