Author |
Message
|
angka |
Posted: Tue Jun 23, 2009 5:05 am Post subject: Map MRM to XMLNSC with namespace |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi,
I checked through this forum and there is similiar question on this but I still did not figure out how to make this work.
I have a message coming in in fixed length format and i created the messge definition. I parsed the message to MRM in the MQ input node then the message go through a mapping node and map to XMLNSC and put to another queue. The message is in XML but without namespace. How do I add namespace to the xml content without using esql?
Thanks |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jun 23, 2009 6:43 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Use a JavaCompute node to add the namespace declarations.
You will need to use MbElement.setSpecificType( MbXMLNSC.NAMESPACE_DECLARATION ) to set the field type of the parent syntax element to the correct value. |
|
Back to top |
|
 |
angka |
Posted: Tue Jun 23, 2009 7:02 am Post subject: |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi,
Is it possible to set it using the message set or the message definition?
Thanks |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jun 23, 2009 12:40 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
No. As I've explained many times on this forum, XMLNSC does not use *any* information from the physical format in the message set.
The only input to the XMLNSC writer is the message tree ( with the appropriate field types set for various types of XML construct ). |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 23, 2009 12:58 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
But the mapping node should read the XSD/message set at runtime and build statements to add the namespace if the message set/XSD says that an element needs a namespace. |
|
Back to top |
|
 |
LazyBoy |
Posted: Tue Jun 23, 2009 7:47 pm Post subject: |
|
|
Voyager
Joined: 04 May 2006 Posts: 78
|
AFAIK, You have to use Compute or Java Compute node to add the namespace. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jun 24, 2009 12:59 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Will people please stop saying 'namespace' when they mean 'namespace declaration'. They are not the same thing.
Every element in the message tree has a namespace ( which may be the empty string ). When an XML message is output, any non-empty namespaces must have corresponding namespace declarations ( xmlns attributes ) which control the prefix that is used.
The MRM parser uses the Namespace table in the message set to control the output of namespace declarations. The XMLNSC parser does not - you have to add them using ESQL/Java. |
|
Back to top |
|
 |
angka |
Posted: Tue Jul 14, 2009 3:13 am Post subject: |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
kimbert wrote: |
No. As I've explained many times on this forum, XMLNSC does not use *any* information from the physical format in the message set.
The only input to the XMLNSC writer is the message tree ( with the appropriate field types set for various types of XML construct ). |
Then what is the use for the physical format?
Btw is there a way to remove those auto generated Namespace NS1 infront of all elements?
Thanks |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jul 14, 2009 3:31 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Then what is the use for the physical format? |
The MRM XML parser uses it. But please don't use the MRM XML parser in new message flows.
Quote: |
Btw is there a way to remove those auto generated Namespace NS1 infront of all elements? |
Yes - you put namespace declarations ( xmlns attributes ) into the XMLNSC mesage tree.
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ac67194_.htm
Java code to do the same thing is discussed earlier in this thread. This is pretty basic stuff, by the way, and it has been discussed many times before. |
|
Back to top |
|
 |
|