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 » load XML tree to MbElement

Post new topic  Reply to topic
 load XML tree to MbElement « View previous topic :: View next topic » 
Author Message
scravr
PostPosted: Mon Jun 20, 2011 10:47 am    Post subject: load XML tree to MbElement Reply with quote

Partisan

Joined: 03 Apr 2003
Posts: 391
Location: NY NY USA 10021

HI All,

How can I load XML tree into MbElement and get byte buffer of it?

I have this XML (SystemOfRecord has multiple sub element trees) :
<SORBuildCmd>
<BuildAction>GenBrk</BuildAction>
<BuildComponent>
...
...
...
</BuildComponent>
...
...
...
<SystemOfRecord>
<Broker brkname="TEST_DROP2">
<ExecutionGroups>
<ExecutionGroup egname="PRFR_FUNC">
...
...
...
...
</ExecutionGroup>
</ExecutionGroups>
</Broker>
<Subscribers>
<Subscriber name="FL01_CASH_PAYMENT_TG01_V0200">
<GenericMsgFlowName>TG01_V0200</GenericMsgFlowName>
<GenericBarName>TG01_V0200</GenericBarName>
...
...
</Subscriber>
</Subscribers>
<GenericBars>
<GenericBar barname="OMB">
</GenericBar>
</GenericBars>
</SystemOfRecord>
</SORBuildCmd>


I need to get the "SystemOfRecord" element and ALL its sub-elements into single MbElement. Then get the tree into "byte" buffer.

The SystemOfRecord has multiple sub element trees.


Here is my code:
public void evaluate(MbMessageAssembly MsgAss) throws MbException {
MbOutputTerminal out = getOutputTerminal("out");
MbElement root = MsgAss.getMessage().getRootElement();
byte sorBuff[] = null;

MbElement SorBld = root.getFirstElementByPath("XMLNSC/SORBuildCmd");
MbElement SysOfRecords = SorBld.getFirstElementByPath("SystemOfRecord");
MbElement cpySysOfRecs = SysOfRecords.copy();
sorBuff = cpySysOfRecs.toBitstream(null,null,null,0,0,0);


The toBitstream always get this error:

ExceptionList
RecoverableException
File:CHARACTER:F:\build\S700_P\src\DataFlowEngine\ImbDataFlowNode.cpp
Line:INTEGER:1073
Function:CHARACTER:ImbDataFlowNode::createExceptionList
Type:CHARACTER:ComIbmMQInputNode
Name:CHARACTER:BRAG/BRAG_MF_V0200#FCMComposite_1_1
Label:CHARACTER:BRAG.BRAG_MF_V0200.MQ Input
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Node throwing exception
RecoverableException
File:CHARACTER:F:\build\S700_P\src\DataFlowEngine\PluginInterface\ImbJniNode.cpp
Line:INTEGER:1178
Function:CHARACTER:ImbJniNode::evaluate
Type:CHARACTER:ComIbmJavaComputeNode
Name:CHARACTER:BRAG/BRAG_MF_V0200#FCMComposite_1_3
Label:CHARACTER:BRAG.BRAG_MF_V0200.BRAG
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Caught exception and rethrowing
ParserException
File:CHARACTER:F:\build\S700_P\src\MTI\MTIforBroker\GenXmlParser4\ImbXMLNSCParser.cpp
Line:INTEGER:786
Function:CHARACTER:ImbXMLNSCParser::refreshBitStreamFromElementsCommon
Type:CHARACTER:ComIbmMQInputNode
Name:CHARACTER:BRAG/BRAG_MF_V0200#FCMComposite_1_1
Label:CHARACTER:BRAG.BRAG_MF_V0200.MQ Input
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:5010
Text:CHARACTER:XML Writing Errors have occurred
ParserException
File:CHARACTER:F:\build\S700_P\src\MTI\MTIforBroker\GenXmlParser4\ImbXMLNSCWriter.cpp
Line:INTEGER:889
Function:CHARACTER:ImbXMLNSCWriter::writeMisc
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:5016
Text:CHARACTER:Unexpected XML type at this point in document.
Insert
Type:INTEGER:5
Text:CHARACTER:Subscribers
Insert
Type:INTEGER:5
Text:CHARACTER:folderType
Back to top
View user's profile Send private message Send e-mail MSN Messenger
lancelotlinc
PostPosted: Mon Jun 20, 2011 11:08 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Its not as simple as your trying to code it.

You might like to try this...

Make a for...next loop, loop through the instances of SystemOfRecord, and for each instance of SystemOfRecord, add it to a ListResourceBundle or similar bag object.

Good luck, sir.

"Join the movement... NFL Play60."
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon Jun 20, 2011 12:07 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So you probably need to specify something for the first parameter, to indicate that the data is associated with the XMLNSC parser.

And you probably need to specify something for the options parameter to indicate that the tree in question represents a folder bitstream rather than a root bitstream.
Back to top
View user's profile Send private message
scravr
PostPosted: Mon Jun 20, 2011 12:57 pm    Post subject: Reply with quote

Partisan

Joined: 03 Apr 2003
Posts: 391
Location: NY NY USA 10021

No need for validation.
Do not have MsgSet.

Could (Deprecated) getAllElementsByPath help?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
mqjeff
PostPosted: Mon Jun 20, 2011 1:01 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Again, please pay attention. I didn't say anything about validation, I said "indicate the data is associated with the XMLNSC parser".

Among other things, the documentation specifically also says
Quote:
This method can only be called on the message body, i.e. the last child of the message root.


Which you are not doing. You are calling it on a folder.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jun 21, 2011 12:50 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

If you never need to look at the contents of the SystemOfRecord tag, then you could use opaque parsing.
That will put a CHARACTER field into the message tree with name 'SystemOfRecord' and the value will be a string representing the entire content of the SystemOfRecord tag. You can convert the CHARACTER string to a byte array easily enough. The CHARACTER field will be in UTF-16, like every other CHARACTER field. So don't try to use InputRoot.Properties.CodedCharSetId when converting the string to a byte array.
Back to top
View user's profile Send private message
scravr
PostPosted: Tue Jun 21, 2011 5:44 am    Post subject: Reply with quote

Partisan

Joined: 03 Apr 2003
Posts: 391
Location: NY NY USA 10021

Jedi Knight - U R the MAN !!!
Back to top
View user's profile Send private message Send e-mail MSN Messenger
kimbert
PostPosted: Tue Jun 21, 2011 9:46 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I hope a 'Jedi Knight' is a good thing...I've never seen Star Wars.
Anyway...thanks. I'm glad it did the job ( well, I assume it did )
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jun 21, 2011 10:15 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kimbert wrote:
I hope a 'Jedi Knight' is a good thing...I've never seen Star Wars.




Unless you're bald with red skin, dubious tattoos and your hair in points you're fine.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jun 21, 2011 10:57 am    Post subject: Reply with quote

Grand High Poobah

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

Vitor wrote:
kimbert wrote:
I hope a 'Jedi Knight' is a good thing...I've never seen Star Wars.




Unless you're bald with red skin, dubious tattoos and your hair in points you're fine.

and don't EVER forget to stay away from the dark side, no matter the temptation...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » load XML tree to MbElement
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.