Author |
Message
|
rakesh ginjupalli |
Posted: Wed Sep 10, 2014 5:04 am Post subject: Reading multiple xml files through same Input Node |
|
|
Newbie
Joined: 10 Sep 2014 Posts: 2
|
HI,
I have requirement where an application will drop an xml into a queue. There are five different schemas for this xml and the input xml can be any one of those.
Now based on the type of xml that came in, I need to parse the xml and trigger the corresponding flow.
How can i do this.
No information reg the type of xml is present in the MQMD or MQRFH2.
If it is xpath, do you have any sample codes for the same.
I assume based on the name of root element we need to route the flow. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Sep 10, 2014 5:17 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The XMLNSC parser will use the root tag of the message to identify the schema to use to parse the message.
The rest is a simple exercise in broker programming. |
|
Back to top |
|
 |
vicentius |
Posted: Wed Sep 10, 2014 5:21 am Post subject: |
|
|
 Apprentice
Joined: 01 Mar 2013 Posts: 28
|
Use the XMLNSC parser on the MQInput node. It will create a representation of the body even without knowing the XML Schema. Later in the flow, you can identifying the type of message you received based on the name and namespace info of the firstchild of Body.XMLNSC tree.
Later edit: What the Grand Master said... |
|
Back to top |
|
 |
Simbu |
Posted: Wed Sep 10, 2014 11:11 pm Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
Adding to that, your message model schema files should be in your application and library. |
|
Back to top |
|
 |
rakesh ginjupalli |
Posted: Thu Sep 11, 2014 1:40 am Post subject: |
|
|
Newbie
Joined: 10 Sep 2014 Posts: 2
|
Thanks for your replies. The information is very useful.
I am planning to look for a specific tag and its value which is common to all the xmls (schemas) and then based on that i will route to the corresponding flow.
For that , I am thinking of using Xpath.
My only confusion is whether to use a route node, or java compute node or manipulate using ESQL code.
(Note : at this point i dont know which xml came in, even though the parser may have parsed with its corresponding schema).
Please correct me if my approach itself is wrong. |
|
Back to top |
|
 |
vicentius |
Posted: Thu Sep 11, 2014 2:41 am Post subject: |
|
|
 Apprentice
Joined: 01 Mar 2013 Posts: 28
|
Sounds promising. Please do come back and let us know what you did and how it worked out. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Sep 11, 2014 3:14 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
The FIELDNAME Function in ESQL can set a variable to the name of a field/tag.
If you are routing based upon the name of the 'root' tag then 2 or 3 lines of esql will do the trick. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Sep 11, 2014 4:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
smdavies99 wrote: |
The FIELDNAME Function in ESQL can set a variable to the name of a field/tag.
If you are routing based upon the name of the 'root' tag then 2 or 3 lines of esql will do the trick. |
Or you put an XPath in a Route node and don't use code at all.
Horses for courses, different strokes, any number of other aphorisms.... _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|