|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MRM and Namespace Prefixes |
« View previous topic :: View next topic » |
Author |
Message
|
TonyD |
Posted: Wed Jun 29, 2005 4:34 am Post subject: MRM and Namespace Prefixes |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
I am working with an XML Schema, with the following declaration:
Code: |
<xs:schema targetNamespace="http://www.xyz.com/Messages/EAI/2005/05/EAIXMLSchema_52" xmlns:tns="http://www.xyz.com/Messages/EAI/2005/05/EAIXMLSchema_52" xmlns="http://www.xyz.com/Messages/EAI/2005/05/EAIXMLSchema_52" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
It has been imported into the ToolKit, with Namespace specified, and with MRM as the runtime parser.
If I create a sample message out of XMLSpy, I get:
Code: |
<?xml version="1.0"?>
<POWA xmlns="http://www.xyz.com/Messages/EAI/2005/05/EAIXMLSchema_52" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xyz.com/Messages/EAI/2005/05/EAIXMLSchema_52
C:\XYZ\XML\InboundSchemas_52\EAIXMLSchema_52.xsd">
<Interaction>
<InteractionId>String</InteractionId>
<InteractionType>POWAPrivateRuling</InteractionType>....
|
However, when the Broker creates the same message I get:
Code: |
<?xml version="1.0"?>
<tns:POWA xmlns:tns="http://www.xyz.com/Messages/EAI/2005/05/EAIXMLSchema_52" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns:Interaction>
<tns:InteractionId>String</tns:InteractionId>
<tns:InteractionType>POWAPrivateRuling</tns:InteractionType>....
|
:i.e. with a 'tns:' prefix in front of everything, which the client does not want!
I therefore added the following statement to my ESQL:
Code: |
SET OutputRoot.MRM.(XML.NamespaceDecl)xmlns = 'http://www.xyz.com/Messages/EAI/2005/05/EAIXMLSchema_52';
|
:hoping that this would mean that the prefix would not be applied. However a trace show that the statement, which follows construction of 'OutputRoot.MRM' from successful parsing of a BLOB, was simply ignored!...the statement does not appear in the trace.
I know that dealing with attributes is different when using the MRM parser and that they have to be populated before the elements to which they belong, so this may be part of the problem; I have not yet experimented further.
Although my ESQL 'NamespaceDecl' did not give a syntax error, there is nothing in the Help or manuals that I have found so far that indicates that you can use such a statment with the MRM!
I would be interested if anyone has any idea how I should set up the schema or .mxsd, or how I could manipulate the OutputRoot, to get rid of the prefix when the message is created. The 'tns:' has to stay in the schema as it is part of a site standard for defining complex types. |
|
Back to top |
|
 |
TonyD |
Posted: Wed Jun 29, 2005 8:57 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
Further to above, disregard:
Quote: |
However a trace show that the statement, which follows construction of 'OutputRoot.MRM' from successful parsing of a BLOB, was simply ignored!...the statement does not appear in the trace.
|
...it was caused by my error.
The ESQL manual section 'Accessing Attributes in the MRM Domain' indicates that attributes are dealt with in the same way as elements (no XML.Attr) and that any attribute inserts must be done before element inserts belonging to the same parent.
In addition to what I showed earlier I have tried, in a subsequent Compute node:
Code: |
SET OutputRoot.MRM.xmlns = 'http://www.xyz.com/Messages/EAI/2005/05/EAIXMLSchema_52';
SET OutputRoot.MRM.*[] = InputRoot.MRM.*[];
|
...and other variations, but usually end up with:
Code: |
<xmlns>http://www.xyz.com/Messages/EAI/2005/05/EAIXMLSchema_52</xmlns>
|
...as the last element in the message, which is not at all what I want.
Specifying a default namespace (xmlns=) in the schema that is imported results in the dreaded 'NS1' prefix.
Still therefore hoping for suggestions. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jun 30, 2005 4:58 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Sorry - I don't think there's any way to make the MRM XML writer do what you want.
Quote: |
with a 'tns:' prefix in front of everything, which the client does not want |
I'm probably being picky, but your client really should not care whether or not prefixes are present, as long as it is valid XML. All the same, I can see that it would be useful to have the option. |
|
Back to top |
|
 |
TonyD |
Posted: Thu Jun 30, 2005 2:37 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
Quote: |
...your client really should not care whether or not prefixes are present, as long as it is valid XML...
|
I agree, but the customer is always right!
At present, my fallback is to 'blob' the OutputRoot and remove all the prefixes, which works OK, but am not too happy with this approach. |
|
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
|
|
|
|