|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Parsing XML with the WMQI Java Classes |
« View previous topic :: View next topic » |
Author |
Message
|
ResidualDream |
Posted: Tue Apr 16, 2002 3:57 am Post subject: |
|
|
Newbie
Joined: 20 Mar 2002 Posts: 4
|
Hi,
Im having a problem with the creation of Java based plugin nodes. I can get them running fine but a need has arisen for me to take an XML document which is stored as a string and parse it for addition to the WMQI message which comes out of the output terminal. I can parse the message with SAX but can't seem to get the job done with the WMQI java classes as the functions dont seem to allow the addition of data parsed with SAX or alternatively its own independent parser.
Any help would be great,
Thanks,
Andy |
|
Back to top |
|
 |
dnaren |
Posted: Tue Apr 16, 2002 11:18 am Post subject: |
|
|
 Apprentice
Joined: 10 Aug 2001 Posts: 45 Location: Charlotte, NC
|
It's not easy to mix any independent parser output with the message represented by MbMessage object in Java plugin. It is not impossible though. You need to go through the painful process of making a new MbElement, set the value/attributes of the element, identify the postition of the new element in the result document and then add the element. Repeat this for each XML tag and value.
It's ridiculuous to follow this procedure for XML documents with large number of nodes. You will end up writing several lines of code. Java API for manipulating the message inside the node is soooooooooo inadequate.
I avoided using that API completely by extracting the message in the form of a Java String at the beginning. I am using SAX parser to parse the message/String. After processing the message, I am building another String to represent the outgoing message. I am sticking this String to the outgoing message and propagating it.
|
|
Back to top |
|
 |
ResidualDream |
Posted: Tue Apr 16, 2002 11:36 pm Post subject: |
|
|
Newbie
Joined: 20 Mar 2002 Posts: 4
|
Thanks for that, im going to persevere, I dont quite understand your method im afraid, will this produce useable XML or just a string containing XML, if the latter can you parse this in WMQI without a DTD?
Thanks once again,
Andy |
|
Back to top |
|
 |
suneelsh |
Posted: Wed Apr 17, 2002 3:39 am Post subject: |
|
|
 Acolyte
Joined: 13 Apr 2002 Posts: 69 Location: Pune,India
|
You could also see the examples given in the rootexamplesJavaPlugincomibmsamples. There are two files TransformNode and SwitchNode. See the transform node to get basic idea how to parse the xml. The
java api docs are stored in the rootdocs directory |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|