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 » WMB MQ input node to handle two different XML's

Post new topic  Reply to topic
 WMB MQ input node to handle two different XML's « View previous topic :: View next topic » 
Author Message
Harshalw
PostPosted: Wed Sep 26, 2012 2:32 am    Post subject: WMB MQ input node to handle two different XML's Reply with quote

Voyager

Joined: 23 Jul 2008
Posts: 77

I Have a WMB job , receiving a XML in MQ Input node , processing the XML entries into compute node and updating the database. Now there is an requirement that there would be different XML format will be received and it will have its own XSD. I am checking here for a way , so that my application would process both the formats and parse against respective XSD. I am using WMB parser here and have created a Message set where in OLD XML will get parsed as soon as comes into Mq input node.

The Format difference is

1. Once New XML tag is added
2. Two of the XML tag has its name changed.


Though not much difference in new XML format , but application would be able to parse the old format as it comes. Please guide me .
Back to top
View user's profile Send private message
whydieanut
PostPosted: Wed Sep 26, 2012 2:41 am    Post subject: Reply with quote

Disciple

Joined: 02 Apr 2010
Posts: 186

Is there any element that will let you distinguish the 2 XMLS?
Is the newly added tag always present in the new XML?

You could use such an indicator to route the message to separate branches in your flow and validate them there instead of at the Input node.
Back to top
View user's profile Send private message
Harshalw
PostPosted: Wed Sep 26, 2012 2:46 am    Post subject: Reply with quote

Voyager

Joined: 23 Jul 2008
Posts: 77

Yes Newly added tag will always be present .

There are two TAGS which are renamed in NEW tag

for ex - <abcd> will be named as <Varabcd>
Back to top
View user's profile Send private message
whydieanut
PostPosted: Wed Sep 26, 2012 2:50 am    Post subject: Reply with quote

Disciple

Joined: 02 Apr 2010
Posts: 186

If there are no other indicators, you could check for the existence of this new tag and then route the message using the Filter or the Route to Label nodes and validate each type of message separately against separate XSDs.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Sep 26, 2012 2:58 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

XML Schema is flexible enough to deal with both formats using one XSD. I would do this:
- add an optional ( minOccurs = 0 ) element for the new tag
- use a substitution group to handle the renamed tag. That's pretty much what substitution groups were invented for.

The only potential downside is that the flexible schema would tolerate a slightly larger range of documents than you are expecting ( mixtures of the two styles ).
Back to top
View user's profile Send private message
Harshalw
PostPosted: Wed Sep 26, 2012 3:33 am    Post subject: Reply with quote

Voyager

Joined: 23 Jul 2008
Posts: 77

Jedi , can you please suggest a way to add substitution group .

I have Message SET created in my WMB job . This message set is called when ever XML arrives on MQ input node and parses the XML.

THis message set name is provided in MQinput node properties section

I am using - XMLNSC - Parser from WMB tool.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Sep 26, 2012 3:47 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

See http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/topic/com.ibm.etools.mft.doc/ad06100_.htm

You don't need to explicitly create the substitution groups. A group is created when one global element points at another global element via its 'substitution group' property. Here's what you need to do:

The new tags must be global elements. The old tags that they are replacing must also be global elements. In each of the new global element declarations, set the 'Substitution Group' property to point at the old version.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Wed Sep 26, 2012 4:50 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

whydieanut wrote:
Is there any element that will let you distinguish the 2 XMLS?
Is the newly added tag always present in the new XML?

You could use such an indicator to route the message to separate branches in your flow and validate them there instead of at the Input node.


That can be achieved with a dispatcher flow which is very common (on the projects that I have been)... though: you will have a couple of queues&flows then.

On the dispatcher-in-queue you don't have a message set: just use XMLNSC and in the dispatcher-flow you (will certainly find) have criteria/elements to make routing (to 2 different out-queues, which will then be the in-queues for the 2 flows with xsds (msgsets created from xsds)).

Though other solutions (as suggested before) are certainly also possible.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Sep 26, 2012 5:01 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

mqsiuser:I think you meant to say
Quote:
On the dispatcher-in-queue you don't switch on validation.

...otherwise it sounds as though XMLNSC does not normally use a message set! Also, there are other uses for message sets apart from validation.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Wed Sep 26, 2012 5:12 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

kimbert wrote:
On the dispatcher-in-queue you don't switch on validation.

I just checked this: It is off by default.

kimbert wrote:
...otherwise it sounds as though XMLNSC does not normally use a message set!

XML "is already parsed"... meaning it is a tree-structure, basically relieving us from parsing (flat files). I thought XML(NS(C)) strengths are to just parse XML (without schema / msg set).

kimbert wrote:
Also, there are other uses for message sets apart from validation.

xsd is for validation ... then msg sets... for XML... and the benefits are ?
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Sep 26, 2012 5:39 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Yes, XML can be parsed without an xsd. So it's easier to process than, say, a COBOL copybook. But please don't confuse the data format called 'XML' with the WMB parsers that handle it.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Wed Sep 26, 2012 6:25 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

If we create a message set (from an xsd) is the parser then parsing the XMLs faster ?
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Sep 26, 2012 6:28 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

No - the speed is roughly the same. May be a little slower if the xsd is a complex one.
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 » WMB MQ input node to handle two different XML's
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.