|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
xml declaration issues |
« View previous topic :: View next topic » |
Author |
Message
|
4integration |
Posted: Wed Jun 27, 2007 9:39 pm Post subject: |
|
|
 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 |
|
 |
hopsala |
Posted: Sat Sep 20, 2008 10:48 am Post subject: |
|
|
 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 |
|
 |
kimbert |
Posted: Sat Sep 20, 2008 12:03 pm Post subject: |
|
|
 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 |
|
 |
hopsala |
Posted: Sun Sep 21, 2008 3:11 am Post subject: |
|
|
 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 |
|
 |
|
|
|
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
|
|
|
|