Datastage - XML Output Stage - Space after tag

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
reachmexyz
Premium Member
Premium Member
Posts: 296
Joined: Sun Nov 16, 2008 7:41 pm

Datastage - XML Output Stage - Space after tag

Post 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?
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post 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.
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
reachmexyz
Premium Member
Premium Member
Posts: 296
Joined: Sun Nov 16, 2008 7:41 pm

Post by reachmexyz »

Thanks

That worked well.
I appreciate your quick help
sreewin7
Participant
Posts: 41
Joined: Tue Sep 14, 2010 8:48 pm

Post by sreewin7 »

Request you to reslove the status.
[quote="reachmexyz"]Thanks

That worked well.
I appreciate your quick help[/quote]
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post 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
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply