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 » want to use java computer node to generate the xml problem

Post new topic  Reply to topic
 want to use java computer node to generate the xml problem « View previous topic :: View next topic » 
Author Message
blackwhites
PostPosted: Thu May 21, 2009 6:27 am    Post subject: want to use java computer node to generate the xml problem Reply with quote

Novice

Joined: 23 Jan 2009
Posts: 10

I want to the following requirement,through the java compute node to generate the following xml to the output

<?xml version="1.0" standalone="no" ?>
<abc>
<a></a>
...
<c></c>
</abc>

<abc>
<a></a>
...
<c></c>
</abc>
it is a String I get from the xml .The following is my code



String outputValue="<abc><a>...</abc> ;
outputBody.createElementAsLastChildFromBitstream(outputValue
.getBytes(), MbXML.PARSER_NAME, "", "", "", 0, 0, 0);
My question is how to add
<?xml version="1.0" standalone="no" ?> to the outAssembly?Can anyone provide some sample code?
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Thu May 21, 2009 7:03 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Why the desire to do this in Java? on the face of it, ESQL will be a much better choice.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Thu May 21, 2009 7:11 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Anyway, I did a quick search and found this link that may help you out....

http://www.mqseries.net/phpBB2/viewtopic.php?t=47003
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu May 21, 2009 11:44 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Don't use the XML domain. Use XMLNSC.

This shows you how to do what you need. Related topics show you how to output an XML message using XMLNSC.
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ac67180_.htm
Back to top
View user's profile Send private message
blackwhites
PostPosted: Thu May 21, 2009 9:11 pm    Post subject: Reply with quote

Novice

Joined: 23 Jan 2009
Posts: 10

now I can add the <?xml version="1.0" standalone="no" ?> to the output. I am using XMLNSC.But the problem the output is add things like
<?xml version="1.0" standalone="no" ?>
<XMLNSC>
<abc>
<a></a>
...
<c></c>
</abc>
<XMLNSC>

I just want to remove XMLNSC from it.
public void evaluate(MbMessageAssembly assembly, MbInputTerminal in)
throws MbException {

MbMessage inMessage = assembly.getMessage();
MbMessage outMessage = new MbMessage();
// message
MbMessageAssembly outAssembly = new MbMessageAssembly(assembly,
outMessage);
MbElement inputRoot = inMessage.getRootElement();
MbElement inputBody = inputRoot.getLastChild();
MbElement outputRoot = outMessage.getRootElement();
MbElement outputBody = outputRoot
.createElementAsLastChild(MbXMLNSC.PARSER_NAME);
MbElement xmlDecl = outputBody.createElementAsFirstChild(MbXMLNSC.XML_DECLARATION);
xmlDecl.setName("XmlDeclaration");
xmlDecl.createElementAsFirstChild(MbXMLNSC.ATTRIBUTE, "version", "1.0");
xmlDecl.createElementAsFirstChild(MbXMLNSC.ATTRIBUTE, "standalone", "yes");

StringBuffer outputsb = new StringBuffer("");

outputBody.append("<abc><a>asas</a></abc>);

outputBody.createElementAsLastChildFromBitstream(outputValue
.getBytes(),MbXMLNSC.PARSER_NAME, "", "", "", 0, 0, 0);



}

} catch (Exception e) {
logErrorGenerateException(this, Constants.METHODNAME,
JRulesComputeNodeMessages.MESSAGE_SOURCE,
JRulesComputeNodeMessages.NO_OUTPUT, "OutPut",
new String[] { outputsb.toString() });
return;
}
// }
getOutputTerminal("Out").propagate(outAssembly);

}
Can anyone help me to reslove this problem?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri May 22, 2009 9:43 am    Post subject: Reply with quote

Grand High Poobah

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

Looks to me like you have a lot to learn...
Get a course on Message Broker. This is not something you can learn just by dreaming about it.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
MQEnthu
PostPosted: Sun May 24, 2009 9:52 pm    Post subject: Reply with quote

Partisan

Joined: 06 Oct 2008
Posts: 329
Location: India

Create the required XML elements using createElement.. method.

Check this: http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ac30340_.htm#ac30340_
_________________
-----------------------------------------------
It is good to remember the past,
but don't let past capture your future
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon May 25, 2009 4:23 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

MQEnthu wrote:
Create the required XML elements using createElement.. method.


Of course the code is already doing that.

Three times. At least one of which is unnecessary and directly causing the undesired (but correct for the code) result.
Back to top
View user's profile Send private message
MQEnthu
PostPosted: Mon May 25, 2009 5:09 am    Post subject: Reply with quote

Partisan

Joined: 06 Oct 2008
Posts: 329
Location: India

mqjeff wrote:
Of course the code is already doing that.


Sorry .. may be I was not clear ealrier..

I meant say to create the XML tags <abc>, <a>... as he has described
_________________
-----------------------------------------------
It is good to remember the past,
but don't let past capture your future
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 » want to use java computer node to generate the xml problem
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.