ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » how to get rid of empty tags

Post new topic  Reply to topic
 how to get rid of empty tags « View previous topic :: View next topic » 
Author Message
kwelch
PostPosted: Fri Oct 31, 2003 8:12 am    Post subject: how to get rid of empty tags Reply with quote

Master

Joined: 16 May 2001
Posts: 255

Hi,

I am formatting an XML output message from legacy cobol. When fields come in with spaces or low-values I don't want to create the empty tags or the shortcut. This seems to be working fine as long as those tags are under aggregates(not sure if this is the correct term, parent?) that have at least one field filled in, but when I hit an entire aggregate where all the fields are blank, I get the shortcut. Is there a way to avoid this? Here is a sample of the xml. The fields in red are the ones I would like not to show up. For example there are fields under <PolicyNumber> that are not showing up because they are spaces but there is one field under that aggregate. For <Prior_Policy_Number> all the incoming fields are space.
Hopefully this explains what I am trying to acoomplish?
<?xml version="1.0" encoding="UTF-8" ?>
- <PINSDataReply>
- <PolicyInfo>
- <PolicyNumber>
<Reg_Off_Code>02</Reg_Off_Code>
</PolicyNumber>
<Name_Insured>THERMA SCAN</Name_Insured>
<Insured_Street>P.O. BOX 121</Insured_Street>
<Insured_City>ELLINGTON</Insured_City>
<Insured_State>CT</Insured_State>
<Zip>06029</Zip>
<Pol_Eff_Date>2001/07/21</Pol_Eff_Date>
<Pol_Exp_Date>2002/07/21</Pol_Exp_Date>
<Policy_Status>S</Policy_Status>
<Prior_Policy_Num />
</PolicyInfo>
- <AgencyInfo>
<Agency_Code>024097</Agency_Code>
</AgencyInfo>
<Error_Messages />
</PINSDataReply>
Back to top
View user's profile Send private message Send e-mail
Michael Dag
PostPosted: Fri Oct 31, 2003 10:00 am    Post subject: Reply with quote

Jedi Knight

Joined: 13 Jun 2002
Posts: 2607
Location: The Netherlands (Amsterdam)

But what does it matter? other then the cosmetic fact that you want to get rid of them?

Michael
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
kwelch
PostPosted: Fri Oct 31, 2003 10:05 am    Post subject: Reply with quote

Master

Joined: 16 May 2001
Posts: 255

Mike,

We don't want to make the message any bigger than it has to be. This is a small example to illustrate the problem but we have other projects that use ACORD XML and there are tons of fields that will not be filled in. Why carry the extra bytes if you don't have to?

Karen
Back to top
View user's profile Send private message Send e-mail
Michael Dag
PostPosted: Fri Oct 31, 2003 10:10 am    Post subject: Reply with quote

Jedi Knight

Joined: 13 Jun 2002
Posts: 2607
Location: The Netherlands (Amsterdam)

Isn't that an oxymoron when using XML?

I get your point.

Michael
The solution I think is to NULL the tags and then they will disappear, now find a way to detect the empty content...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
kwelch
PostPosted: Fri Oct 31, 2003 10:46 am    Post subject: Reply with quote

Master

Joined: 16 May 2001
Posts: 255

Hi Michael,

Yeah I get your point also!

I was trying to incorporate a suggestion given to me to use the NULLIF statement. I was coding the following:

SET OutputRoot.XML.PINSDataReply.PolicyInfo.Prior_Policy_Num.Prior_Pol_Num = NULLIF(TRIM("InputBody"."XCS08_POLICY_INFO"."XCS08_POLICY_INFO_D"."XCS08_PRIOR_POLICY_NUMBER"."XCS08_PRIOR_POL_NUM"), ' ');

By coding the below I resolved the empty tag issue:

IF TRIM("InputBody"."XCS08_POLICY_INFO"."XCS08_POLICY_INFO_D"."XCS08_PRIOR_POLICY_NUMBER"."XCS08_PRIOR_POL_NUM") <> ' ' THEN
SET OutputRoot.XML.PINSDataReply.PolicyInfo.Prior_Policy_Num.Prior_Pol_Num =
TRIM("InputBody"."XCS08_POLICY_INFO"."XCS08_POLICY_INFO_D"."XCS08_PRIOR_POLICY_NUMBER"."XCS08_PRIOR_POL_NUM");
END IF;

I guess by setting it to NULL you are somehow still referencing that higher tag? This way no reference is made to Prior_Policy_Num so I don't get the <Prior_Policy_Num/>.

Thanks for your responses.

Karen
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » how to get rid of empty tags
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.