|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Adding a namespace to a Reference variable |
« View previous topic :: View next topic » |
Author |
Message
|
satya2481 |
Posted: Tue Feb 21, 2012 3:08 am Post subject: Adding a namespace to a Reference variable |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
Hi All,
I am facing an issue while creating a XML Message with a namespace added to the Root element and its children. Can someone provide information on how to achive this.
We have a framework (Subflow) which will keep the entire incoming message in the Environment tree and we have to use its reference variable. Similarly the framework will create the required response mesage with its root tag in the Environment and provide the reference to that element. We have to use this reference variable and construct required response mesage. Not understanding how to add namespace to this root element.
For example my required response message looks like below.
Code: |
<Name xmlns:"myNamespace">
<xmlns:FNAME>SSS</xmlns:FNAME>
<xmlns:LNAME>SSS</xmlns:LNAME>
</Name> |
The framework provides a reference variable to Name tag. Now how to create/attach namespace for this element.
Thank you in advance
Satya |
|
Back to top |
|
 |
kimbert |
Posted: Tue Feb 21, 2012 4:58 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Start here: http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ac67194_.htm
Here are some important points that people often miss:
- you ( in your ESQL or Mapping node or Java ) *must* set the correct namespace on every element in the message tree
- The XMLNSC parser will automatically assign a namespace prefix to each different namespace in the message tree when it converts the message tree to an XML document.
- if you don't like the automatically-chosen namespace prefixes ( 'NS1', 'NS2' etc ) then you can add namespace declarations into your message tree. Read the info center page to find out how.
btw, the XML that you posted is not well-formed XML. In fact, there are at least two things wrong with it, and I can't work out exactly what you are trying to output. So please post the correct XML if you need to ask for more help. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Feb 21, 2012 6:43 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
kimbert wrote: |
btw, the XML that you posted is not well-formed XML. In fact, there are at least two things wrong with it, and I can't work out exactly what you are trying to output. So please post the correct XML if you need to ask for more help. |
To quote a song lyric by Procul Harum (yeah, I'm showing my age as I did see them live before 1970),
There is a lot of it about
{from the album 'Grand Hotel' circa 1972 ish}
We do seem to be seeing rather a lot of rather 'wierd' XML recently. I have to wonder in some of the people developing the system that are sending data have ever really thought about how their data structures look let alone considered validating them against an XSD.
Perhaps there is a team of people out there acting like 'C' hackers did 20years ago and deliberately sending the most obfuscated and awkward XML possible just to make life hard for those who have to use it.
3 _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 21, 2012 6:49 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
it's much more likely the fault of code-generators that are producing Object->Xml mappings.
Well, code generators and poor object design...  |
|
Back to top |
|
 |
joebuckeye |
Posted: Tue Feb 21, 2012 9:24 am Post subject: |
|
|
 Partisan
Joined: 24 Aug 2007 Posts: 365 Location: Columbus, OH
|
mqjeff wrote: |
it's much more likely the fault of code-generators that are producing Object->Xml mappings. |
I had a project recently where a sending application said they could send XML but in reality they weren't.
It was mostly XML but it couldn't handle attributes. That was a problem because the receiving application was expecting some attributes (it was a standard WSDL based web service).
The 'developers' on the sending side were merely trying to use some piece of software to generate the 'XML' and had no understanding of XML at all. At one point they thought they had their system generating attributes but it was really just part of the tag name as the attributes were appearing in the end tags also.
We had to put an adapter flow in the middle of the process to translate their pseudo-XML into real XML.
It's going into production in March. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|