Page 1 of 1

Datastage - XML Output Stage - Space after tag

Posted: Wed May 16, 2012 2:53 pm
by reachmexyz
Hello Everyone

I have a process to generate xml feed using XML output stage.
Tags and values are displayed on each line on output file.
Sample data :
<expMonth>
10
</expMonth>

When i run the XML against XSD ( <expMonth> value is required under XSD ), XML Spy throws an error at <expMonth>.
Error is : Value '10' violates 'maxLength' facet value '2'.

Due to space after each tag <expMonth>space and after each value 10 followed by space, XSD is considering the value length as 4 and throwing an error.
I removed 10 and made the data as
<expMonth>

</expMonth>
and ran through XSD, this time it is successfull as two spaces alone made XSD run successfull.

Now how can i remove spaces which are occuring after each tag and after each value in XML?

Posted: Wed May 16, 2012 3:01 pm
by eostic
shut off all formatting. The xml should go out as one big giant string, which is what you want anyway....it saves bytes on the wire or wherever else you might be sending the xml.

Posted: Wed May 16, 2012 3:37 pm
by reachmexyz
Thanks

That worked well.
I appreciate your quick help

Posted: Wed May 16, 2012 11:50 pm
by sreewin7
Request you to reslove the status.
[quote="reachmexyz"]Thanks

That worked well.
I appreciate your quick help[/quote]

Posted: Thu May 17, 2012 6:14 am
by eostic
Glad it worked.....it's very odd though, that it failed...CRLFs and blanks are "noise" for XML...and most valid parsers should ignore them.....

Either way, the removal of formatting is a best practice that everyone should follow, and it has been well documented in this forum.

Ernie