xml output

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
vasubabu
Participant
Posts: 153
Joined: Wed Jan 25, 2006 2:38 am

xml output

Post by vasubabu »

Hi,

I am creating the xml file using the xml output stage.But in my source some of the fields have the NULL values.After creation of the xml file ,i am not finding the closed tag to those columns which are NULLs in source side.
I have checked the option "open and close tags" in transformation setytings of XML output stage.Still i am not getting the clsed tag in my final XML output file.

Got the output as :-
<CustDetails>
<CIFId>id123</CIFId>
<CustCompTyp />
<CustLang />
</CustDetails>
Please suggest.
VASU..
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

I haven't tested all the variations with nulls and that setting, but from an xml perspective, it doesn't matter...

<CustLang/> and <CustLang></CustLang> are equivalent.

...provided however, that the person/application who is reading your document understands xml, and is using a normal xml parser. You should be fine.

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 »

You have a closing tag, a valid one but just not the one you think it needs to be. You can change the option from <tag/> to <tag></tag> but they are equivalent.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vasubabu
Participant
Posts: 153
Joined: Wed Jan 25, 2006 2:38 am

Post by vasubabu »

Hi,

we are sending this XML document to downstream systems.They need in the format like <tag></tag>.
As you said there is an option to change it,can you guide me where can i change the option in datastage to get this kind of output.
VASU..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I don't have any kind of access but it shouldn't be all that hard to find in the stage... should mention something about 'closing tags'.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vasubabu
Participant
Posts: 153
Joined: Wed Jan 25, 2006 2:38 am

Post by vasubabu »

chulett wrote:I don't have any kind of access but it shouldn't be all that hard to find in the stage... should mention something about 'closing tags'.
Yes.there is an option like "open and close tags" in transformation settings of XML output stage.still i did not get the open and closed tags for NULL value columns.
VASU..
myukassign
Premium Member
Premium Member
Posts: 238
Joined: Fri Jul 25, 2008 8:55 am

Post by myukassign »

Normally all XML parser's can read an empty tag in the format <empty/> which is equalent to <empty></empty>.

May I know the files you produced, are you viewing through any browser like internet explorer / mozilla etc.. if yes then it will by default show you in the format <empty/> but if you open the same file using notepad, you should be able to see the same in <empty></empty> format.

Please check that and let us know what you see in the file when you open it through the notepad.

Note. All parsers whether it is custom made / product based should follow W3C xml 1.0 standard. According to the standard the parser should read <empty/> and <empty> </empty> in the same way. Thanks.
vasubabu
Participant
Posts: 153
Joined: Wed Jan 25, 2006 2:38 am

Post by vasubabu »

myukassign wrote:Normally all XML parser's can read an empty tag in the format <empty/> which is equalent to <empty></empty>.

May I know the files you produced, are you viewing through any browser like internet explorer / mozilla etc.. if yes then it will by default show you in the format <empty/> but if you open the same file using notepad, you should be able to see the same in <empty></empty> format.

Please check that and let us know what you see in the file when you open it through the notepad.

Note. All parsers whether it is custom made / product based should follow W3C xml 1.0 standard. According to the standard the parser should read <empty/> and <empty> </empty> in the same way. Thanks.
Thanks for the information.
I have passed the same to users and waiting for the reply.
VASU..
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

empty tags

Post by Sreenivasulu »

myukassign wrote:Normally all XML parser's can read an empty tag in the format <empty/> which is equalent to <empty></empty>.

May I know the files you produced, are you viewing through any browser like internet explorer / mozilla etc.. if yes then it will by default show you in the format <empty/> but if you open the same file using notepad, you should be able to see the same in <empty></empty> format.

Please check that and let us know what you see in the file when you open it through the notepad.

Note. All parsers whether it is custom made / product based should follow W3C xml 1.0 standard. According to the standard the parser should read <empty/> and <empty> </empty> in the same way. Thanks.

You are right but its <empty/> in the text editor then it shows <empty/> in browsers (NOT <empty> </empty> ). Its funny since i though browsers just show the text in the form of a tree (using a dtd)

Regards
Sreeni
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Interesting... never knew that a browser would show something like an empty tag differently than it was in the source but just confirmed the behaviour for myself. But then it was never my tool of choice to check the validity of xml.
Normally all XML parser's can read an empty tag in the format <empty/> which is equalent to <empty></empty>.
Third time that little tidbit has been mentioned in this thread. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

I found that generally the developers use 'xmleditors' but the 'operations/users' use browsers to look into the contents of the xml

Regards
Sreeni
Post Reply