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 » Broker 7: Remove empty XML elements

Post new topic  Reply to topic Goto page Previous  1, 2
 Broker 7: Remove empty XML elements « View previous topic :: View next topic » 
Author Message
rbicheno
PostPosted: Wed Jun 29, 2011 5:05 am    Post subject: Reply with quote

Apprentice

Joined: 07 Jul 2009
Posts: 43

I would also suggest you search for some generic java or XSLT code to remove empty elements, its not an uncommon issue, that's been solved before in those technologies. Then drop the code into an XSLT or Java compute node. Its not as efficient as using ESQL as you will not be working directly on the tree but should work and save time!
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Wed Jun 29, 2011 5:08 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

How are you doing the mapping between the COBOL format and XML?

We use ESQL to our mapping and wrote a generic function for getting XML data from the COBOL fields.

This function trims leading and trailing spaces from the COBOL fields and if the resulting data field is nothing the function returns NULL, thus deleting the XML field.

Here is a sample call we make:

SET outputRef.outputField1 = getXMLData(inputRef.cobolField1);

Every SET statement uses this getXMLData() function to clean the input data and allow the removal of empty data fields.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jun 29, 2011 5:09 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Of course, if you remove an empty element and the XSD that describes the data does not indicate that the field is nillable, then you have created a non-conforming document.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Wed Jun 29, 2011 5:29 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

Well, there is that.

We use Datapower in addition to the broker and we are amazed by the number of providers we use that give us a WSDL for their web service and then their own responses aren't valid according to the WSDL's and/or schemas they give us. So we end up having to turn off response validation in the Web Service Proxy.
Back to top
View user's profile Send private message
kimbert
PostPosted: Sat Jul 02, 2011 11:11 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Of course, if you remove an empty element and the XSD that describes the data does not indicate that the field is nillable, then you have created a non-conforming document.
I hate to be pedantic but...
making an element nillable does not allow you to delete it from the document. Setting minOccurs to zero would.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sat Jul 02, 2011 11:58 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

kimbert wrote:
Quote:
Of course, if you remove an empty element and the XSD that describes the data does not indicate that the field is nillable, then you have created a non-conforming document.
I hate to be pedantic but...

I think I know you too well to believe that...

kimbert wrote:
making an element nillable does not allow you to delete it from the document. Setting minOccurs to zero would.

Regardless, one can't just randomly remove elements from an XML document without understanding the meaning of the document.
Back to top
View user's profile Send private message
madi
PostPosted: Thu Jul 07, 2011 8:39 am    Post subject: Reply with quote

Chevalier

Joined: 17 Jan 2006
Posts: 475

joebuckeye wrote:
How are you doing the mapping between the COBOL format and XML?

We use ESQL to our mapping and wrote a generic function for getting XML data from the COBOL fields.

This function trims leading and trailing spaces from the COBOL fields and if the resulting data field is nothing the function returns NULL, thus deleting the XML field.

Here is a sample call we make:

SET outputRef.outputField1 = getXMLData(inputRef.cobolField1);

Every SET statement uses this getXMLData() function to clean the input data and allow the removal of empty data fields.


how is the performance? isnt calling a function on every mapping resource intensive??
_________________
IBM Certified Solutions Developer - WMB 6.0
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Fri Jul 08, 2011 5:17 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

madi wrote:
joebuckeye wrote:
How are you doing the mapping between the COBOL format and XML?

We use ESQL to our mapping and wrote a generic function for getting XML data from the COBOL fields.

This function trims leading and trailing spaces from the COBOL fields and if the resulting data field is nothing the function returns NULL, thus deleting the XML field.

Here is a sample call we make:

SET outputRef.outputField1 = getXMLData(inputRef.cobolField1);

Every SET statement uses this getXMLData() function to clean the input data and allow the removal of empty data fields.


how is the performance? isnt calling a function on every mapping resource intensive??


Performance is acceptable in our case.

This is a very small ESQL function that is within the same ESQL module as the procedure that is calling it.

Not sure if calling an ESQL function repeatedly would be any more resource intensive than having the code inline.

If for nothing else the ease of maintenance by having this functionality in a function is worth it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Broker 7: Remove empty XML elements
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.