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 Generate Empty Tags On XML Message?

Post new topic  Reply to topic
 How To Generate Empty Tags On XML Message? « View previous topic :: View next topic » 
Author Message
Maniel
PostPosted: Thu Feb 16, 2006 9:18 pm    Post subject: How To Generate Empty Tags On XML Message? Reply with quote

Newbie

Joined: 23 Jul 2003
Posts: 4

Hi,

I'm very new to WMB product and working on PoC exercise with WMB v6. I'm trying to map a fix-length message to an xml message using mapping node and pre-defined xml schema. Sound like the WMB generates only the mapped fields and ignored those empty tags. For some reasons, it does not generate xml according to the message set schema.

We did a work around by inserting '' into each empty tag field within the mapping node, then it can generate those empty tags.

It won't be the best solution when map the huge xml schema, would like to hear other suggestion?
_________________
Thanks & Regards
Maniel
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Feb 17, 2006 1:34 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
For some reasons, it does not generate xml according to the message set schema.
I think I know what you mean, but can you give an example ( what's in the schema, what you expected on the output side, what you actually got).
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Feb 17, 2006 1:37 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Are the empty tags not being generated defined as mandatory or optional?
If defined as optional it is working as designed.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Maniel
PostPosted: Fri Feb 17, 2006 9:15 am    Post subject: Reply with quote

Newbie

Joined: 23 Jul 2003
Posts: 4

kimbert wrote:
I think I know what you mean, but can you give an example ( what's in the schema, what you expected on the output side, what you actually got).



This is my input xml schema
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="Body">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="Tag_A"/>
                <xsd:element ref="Tag_B"/>
                <xsd:element ref="Tag_C"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Envelope">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="Body"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Tag_A" type="xsd:string"/>
    <xsd:element name="Tag_B" type="xsd:string"/>
    <xsd:element name="Tag_C" type="xsd:string"/>
</xsd:schema>



If I map something to Tag_A only, Tag_B & Tag_C won't appear in the xml message.
Code:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
      <Tag_A>AAAAA</Tag_A>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


I expect it can generate empty tags <Tag_B> & <Tag_C>, even they are empty.
Code:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
      <Tag_A>AAAAA</Tag_A>
      <Tag_B></Tag_B>
      <Tag_C></Tag_C>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

_________________
Thanks & Regards
Maniel
Back to top
View user's profile Send private message
Maniel
PostPosted: Fri Feb 17, 2006 9:18 am    Post subject: Reply with quote

Newbie

Joined: 23 Jul 2003
Posts: 4

fjb_saper wrote:
Are the empty tags not being generated defined as mandatory or optional?
If defined as optional it is working as designed.

Enjoy



In the .mxsd file, I specify the Min Occurs to '1'. Not sure where else I should define this field is mandatory?
_________________
Thanks & Regards
Maniel
Back to top
View user's profile Send private message
mustache
PostPosted: Fri Mar 31, 2006 1:34 am    Post subject: use this esql code can generate null value XML tag Reply with quote

Newbie

Joined: 21 Feb 2003
Posts: 9

SET OutputRoot.XML.A.DATA VALUE=null;
Back to top
View user's profile Send private message
sirsi
PostPosted: Wed Apr 05, 2006 12:22 pm    Post subject: Reply with quote

Disciple

Joined: 11 Mar 2005
Posts: 177

also this should work i think..

SET OutputRoot.XML.A.DATA ='';


Last edited by sirsi on Fri Apr 21, 2006 11:29 am; edited 1 time in total
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Apr 06, 2006 12:20 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Setting minOccurs will not affect this scenario. The XML writer will output whatever is in the message tree. If you have not mapped B and C, no tags will be generated. If you want B and C in the output ( as empty tags) you will have to do as sirsi suggests.
Back to top
View user's profile Send private message
shalabh1976
PostPosted: Thu Apr 06, 2006 12:49 am    Post subject: Reply with quote

Partisan

Joined: 18 Jul 2002
Posts: 381
Location: Gurgaon, India

I haven't worked in MB6 but shouldn't :
Code:
CREATE FIELD OutputRoot.XML.A.DATAVALUE;

give the same result
_________________
Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
sirsi
PostPosted: Fri Apr 21, 2006 12:27 pm    Post subject: Reply with quote

Disciple

Joined: 11 Mar 2005
Posts: 177

info:

http://publib.boulder.ibm.com/infocenter/wbihelp/v6rxmx/index.jsp?topic=/com.ibm.etools.mft.doc/ac17250_.htm

Quote:
You might want an empty element in the output message. On input, an empty element of the form <tag></tag> is interpreted as identical to one of the form <tag/>. On output, the default behavior of the generic XML parser is to generate empty elements in the first of these two forms. If you require the second (short) form of empty element, set the content of the element to NULL. The statement:

SET OutputRoot.XML.Invoice.Cashier.(XML.Content) = NULL;

Back to top
View user's profile Send private message
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 Generate Empty Tags On XML Message?
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.