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 » xml declaration issues

Post new topic  Reply to topic Goto page Previous  1, 2
 xml declaration issues « View previous topic :: View next topic » 
Author Message
4integration
PostPosted: Wed Jun 27, 2007 9:39 pm    Post subject: Reply with quote

Disciple

Joined: 04 Sep 2006
Posts: 197
Location: Gothenburg, Sweden

Thanks, I also found that after a while
Since I already have the XmlDeclaration element I used the slightly modified version:
Code:
MbElement xmlRoot = outAssembly.getMessageBodyElement();
// Select the XML declaration parent node
MbElement xmlDecl = xmlRoot.getFirstChild();
// Set the encoding
MbElement encoding = xmlDecl.createElementAsFirstChild(MbXMLNSC.ATTRIBUTE, "Encoding", "utf-8");

_________________
Best regards
4 Integration
Back to top
View user's profile Send private message
hopsala
PostPosted: Sat Sep 20, 2008 10:48 am    Post subject: Reply with quote

Guardian

Joined: 24 Sep 2004
Posts: 960

kimbert wrote:
//Create the XML domain root node
MBElement xmlRoot = root.createElementAsLastChild(MbXMLNS.PARSER_NAME);

//Create the XML declaration parent node
MbElement xmlDecl = xmlRoot.createElementAsFirstChild(MbXMLNSC.XML_DECLARATION);

xmlDecl.setName("XmlDeclaration");

MbElement version = xmlDecl.CreateElementAsFirstChild(MbXMLNSC.ATTRIBUTE, "Version", "1.0");
MbElement encoding = xmlDecl.CreateElementAsFirstChild(MbXMLNSC.ATTRIBUTE, "Encoding", "utf-8");

For future reference, this code requires some changes in order to work for XMLNS. The following seems to be the way to do it:

Quote:
//Create the XML domain root node
MBElement xmlRoot = root.createElementAsLastChild(MbXMLNS.PARSER_NAME);

//Create the XML declaration parent node
MbElement xmlDecl = xmlRoot.createElementAsFirstChild(MbXMLNS.XML_DECL);

xmlDecl.setName("XmlDeclaration");

MbElement version = xmlDecl.CreateElementAsFirstChild(MbXMLNS.VERSION, "Version", "1.0");
MbElement encoding = xmlDecl.CreateElementAsFirstChild(MbXMLNS.ENCODING, "Encoding", "utf-8");


Last edited by hopsala on Sun Sep 21, 2008 3:08 am; edited 1 time in total
Back to top
View user's profile Send private message
kimbert
PostPosted: Sat Sep 20, 2008 12:03 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5543
Location: Southampton

Working as designed. You should not expect code which is written for the XMLNSC domain to work unchanged with the XMLNS domain.
Glad you managed to work out how to do the equivalent trick for XMLNS, and thanks for posting the code.
Back to top
View user's profile Send private message
hopsala
PostPosted: Sun Sep 21, 2008 3:11 am    Post subject: Reply with quote

Guardian

Joined: 24 Sep 2004
Posts: 960

You're right, kimbert, I made it sound as if it was a bug, and not simply an XMLNS/XMLNSC difference. I edited my post accordingly.

Cheers.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » xml declaration issues
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.