Page 1 of 1

XML CRLF error

Posted: Fri Dec 21, 2007 4:06 pm
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?

Posted: Fri Dec 21, 2007 5:12 pm
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

Posted: Fri Dec 21, 2007 5:25 pm
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?

Posted: Sat Dec 22, 2007 6:49 pm
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

Posted: Sat Dec 22, 2007 7:09 pm
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.

Posted: Mon Dec 24, 2007 8:24 pm
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

Posted: Tue Dec 25, 2007 7:47 am
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.