|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MRM-XML Namespaces (again...) |
« View previous topic :: View next topic » |
Author |
Message
|
billybong |
Posted: Mon Nov 03, 2008 6:36 am Post subject: MRM-XML Namespaces (again...) |
|
|
 Disciple
Joined: 22 Jul 2005 Posts: 150 Location: Stockholm, Sweden
|
K guys, I know this topic has been discussed before but I haven't really found a good answer for it yet so please bear with me.
Is there really no way to configure the messageset to not output prefixes on each and every element in the outbound message while creating an MRM XML namespace aware format?
What I'm dealing with is mapping a fixed length format to an MRM XML one needed for validation (so, now that's said..). My output becomes ie:
Code: |
<myPrefix:A xmlns:myPrefix="http://jadajada">
<myPrefix:B>somevalue</myPrefix:B>
</myPrefix:A>
|
When what I really want is:
Code: |
<myPrefix:A xmlns:myPrefix="http://jadajada">
<B>somevalue</B>
</myPrefix:A>
|
The schema I was given had all elements as global elements which is why I guess I HAVE to specify the namespace for each and everyone of them, I'm fine with that since that is needed for validation.
But I dont like the fact that the broker seems to not give me any options of how to present this in my XML format.
Is there no way for me to set the output to use the http://jajajada namespace as default for everything under element A?
I could guess that the reason the broker treats XML this way is so that the recieving application should know for certain that the elements really are in the same namespace, but this is just me thinking loud.
I'm using the 6.0 broker BTW...
Any thoughts? _________________ IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Integration Developer V6.0
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere DataPower |
|
Back to top |
|
 |
kimbert |
Posted: Mon Nov 03, 2008 8:09 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
First of all, can I check that I understand what you are trying to achieve:
- Parse a non-XML fixed-length message
- Generate an XML message with an identical logical structure
- Validate the XML message
- Output the XML message to a downstream application
Quote: |
mapping a fixed length format to an MRM XML one needed for validation |
Just checking: you do realise that you can validate the non-XML message if you want to? Validation acts on the message tree, not on the bitstream.
Quote: |
what I really want is:
<myPrefix:A xmlns:myPrefix="http://jadajada">
<B>somevalue</B>
</myPrefix:A> |
So you do not want tag B to have a namespace, right? In that case, you need to ensure that element B in the message tree does not have a namespace. Actually, I think you have mis-typed that XML example. See below for what I think you meant.
Quote: |
The schema I was given had all elements as global elements which is why I guess I HAVE to specify the namespace for each and everyone of them, I'm fine with that since that is needed for validation.
|
If B is a global element in the schema, then it will automatically inherit the schema's target namespace. You will need to ensure that element B in your message tree has a namespace. An easy way to do that is to ensure that element defintion B in your message set has the appropriate namespace.
Your 'what I really want' example above will not validate against your schema because tag B has no namespace ( but that's probably a typing mistake on your part, as suggested below )
Quote: |
But I dont like the fact that the broker seems to not give me any options of how to present this in my XML format. |
The MRM parser will output a prefix if the element in the message tree has a namespace. However, I think you really want the MRM parser to output a message like this:
Code: |
<A xmlns="http://jadajada">
<B>somevalue</B>
</A> |
That is using a 'default namespace' ( i.e. it is assigning a URI to an empty prefix ). The MRM parser does not allow you to *write* default namespaces ( it can parse them OK ). If you need to output default namespaces, use XMLNSC. |
|
Back to top |
|
 |
billybong |
Posted: Tue Nov 04, 2008 12:40 am Post subject: |
|
|
 Disciple
Joined: 22 Jul 2005 Posts: 150 Location: Stockholm, Sweden
|
Thanks for your help Kimbert, I actually hoped you would be the one answering my question since I've seen that you've responded to similar ones quite often and correctly.
Actually we're implementing a transformation between different logical structures, so validating the input message will not solve our validation requirements.
Both messages formats exists today and will not change, so its up to the broker to map between the formats.
You're absolutely right in correcting me about what I inteded to get as output, and from what I can understand from your answer there is no way to tell the MRM parser to output a default namespace. This is a bummer for me, but I'm glad its finally clear to me.
Very much appriciated.
kimbert wrote: |
The MRM parser will output a prefix if the element in the message tree has a namespace. However, I think you really want the MRM parser to output a message like this:
Code: |
<A xmlns="http://jadajada">
<B>somevalue</B>
</A> |
That is using a 'default namespace' ( i.e. it is assigning a URI to an empty prefix ). The MRM parser does not allow you to *write* default namespaces ( it can parse them OK ). If you need to output default namespaces, use XMLNSC. |
_________________ IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Integration Developer V6.0
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere DataPower |
|
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
|
|
|
|