Author |
Message
|
RB |
Posted: Thu Mar 15, 2007 8:06 am Post subject: noNamespaceSchemaLocation using MRM domain |
|
|
Acolyte
Joined: 23 May 2006 Posts: 56
|
Hi All,
I am trying to create a root level attribute xsi:noNamespaceSchemaLocation using MRM domain. I created a message structure and then added an attribute "xsi_noNamespaceSchemaLocation". But in the output I am getting xmlns:noNamespaceSchemaLocation.
Is it possible to get xsi:noNamespaceSchemaLocation using MRM domain? Any help on this is greatly appreciated.
I am using MB 6.
Regards,
RB |
|
Back to top |
|
 |
kimbert |
Posted: Fri Mar 16, 2007 1:16 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
More info please.
- Insert a Trace node just before the output node and trace ${Root}. Post the result here.
- Please list any entries in the 'Namespaces' table in the message set properties of your XML physical format. |
|
Back to top |
|
 |
RB |
Posted: Mon Mar 19, 2007 12:39 pm Post subject: |
|
|
Acolyte
Joined: 23 May 2006 Posts: 56
|
Thanks Kimbert for the reply.
I can see the attribute getting populated in the trace file. And I don't have any entry in the namespace table in the message set.
Here is the trace file output.
Code: |
(0x01000021):MRM = (
(0x03000000):xmlns_xsi = 'http://www.w3.org/2001/XMLSchema-instance'
(0x03000000):xsi_noNamespaceSchemaLocation = 'Input.xsd'
(0x03000000):scenario = 'Scenario'
(0x0300000B):transactionID = '12345678901234567890123456'
(0x03000000):sourceSystem = 'Source'
(0x01000000):HierarchyCollection = (
(0x01000000):HierarchyNode = (
(0x03000000):type = 'A'
(0x0300000B):name = '11'
(0x03000000):parentRefType = ''
(0x03000000):parentRefName = ''
(0x0300000B):description = '567890123456789012345678901234'
)
)
) |
and the output in the queue is given below
Code: |
<?xml version="1.0"?>
<input xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:noNamespaceSchemaLocation="Input.xsd" scenario="Scenario" transactionID="12345678901234567890123456" sourceSystem="Source">
<HierarchyCollection>
<HierarchyNode type="A" name="11" parentRefType="" parentRefName="" description="567890123456789012345678901234"></HierarchyNode>
</HierarchyCollection>
</input>
|
Regards,
RB |
|
Back to top |
|
 |
kimbert |
Posted: Mon Mar 19, 2007 3:21 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
A few more questions ( bear with me, I'll come up with the answer soon )
1. Where have the underscores ( as in 'xsi_noNamespaceSchemaLocation' ) come from? Did you mean to write 'xsi:noNamespaceSchemaLocation' or do you think this is being done by WMB ( if it is, then it's the first time ever ).
2. Does your message set have namespaces enabled?
3. Why are there no namespaces on the elements in the message tree? |
|
Back to top |
|
 |
RB |
Posted: Tue Mar 20, 2007 10:30 am Post subject: |
|
|
Acolyte
Joined: 23 May 2006 Posts: 56
|
Thanks Kimbert for your help.
1) I renamed the existing "xsi_schemaLocation" attribute to "xsi_noNamespaceSchemaLocation". Broker by default creates the attribute with '_' instead of ':'. So I tried to create the variable with '_'.
2) No. But I have tried with namespace enabled as well, but couldn't get the desired output.
3) Actually we are not using any namespaces in the message tree. The application is not using namespace and that is the reason for adding a variable with name "noNamespaceSchemaLocation". They need this attribute for retrieving the correct xsd and parsing the message.
I tried couple of options like adding a new attribute, renaming the existing SchemaLocation attribute, using namespace in the message set, etc. But couldn't get it work. Am I doing something wrong here?
Regards,
RB |
|
Back to top |
|
 |
kimbert |
Posted: Tue Mar 20, 2007 3:17 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
OK - here's what I should have said in my first reply...
You don't need to create an element in the message tree representing noNamespaceSchemaLocation. In your message set you specify the value that you want and the MRM parser does the rest. Open the message definition file, go to the definition of the message, and look at its XML physical format properties. There is a table with title 'Namespace schema locations'.
Edit that table, redeploy your message set, and it should all work as you require it to.
Apologies for misleading you earlier. |
|
Back to top |
|
 |
cjr8020 |
Posted: Mon Nov 24, 2008 5:53 pm Post subject: |
|
|
Newbie
Joined: 25 Sep 2006 Posts: 8
|
Toolkit 6.0.2 IFix 016
MQSI runtime 6.0.0.8
This matches the exact issue I'm facing. By default, I'm getting
Code: |
<SomeElement xmlns:xsd=".." xmlns:xsi="..">
|
I need to add xsi:noNamespaceSchemaLocation. Followed kimbert's recommendation, however, the problem seems to be that the "Namespace schema locations" table forces me to specify a "Namespace URI" and only then will it accept a "Schema location". If I specify Namespace URI as "someURI" just to see what happens, here's what I get:
Code: |
<SomeElement xmlns:xsd=".." xmlns:xsi=".." xsi:schemaLocation="someURI OrgManagementService">
|
And I just need to produce
Code: |
<SomeElement xmlns:xsi=".." xsi:noNamespaceSchemaLocation="SomeElementSchema.xsd">
|
without any Namespace URI? Is there a way to do that?
What am I missing?
Thanks |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Nov 24, 2008 7:46 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
If my understanding is correct you require the schemaLocation to do some verification of the schema....
What you are missing is that you can define a namespace with no urn.
<myelt xmlns:myns="" xsi:schemaLocation="some uri">
</myelt>
So instead of passing everything in the MessageSet that might be stricter and require the namespace not to be empty, you might have to do it all in ESQL.
And as you may have guessed this might up ending being considered as a default namespace and as such need to prefix all your elements.
If you have the xsd I would just try to import it into the message set and see how that goes.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
cjr8020 |
Posted: Tue Nov 25, 2008 10:09 am Post subject: |
|
|
Newbie
Joined: 25 Sep 2006 Posts: 8
|
In ESQL, here's the only way I've found so far to specify noNamespaceSchemaLocation attribute:
Code: |
DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.MRM.(XMLNSC.Attribute){xsi}:noNamespaceSchemaLocation = 'SomeSchema.xsd';
|
The output this produces looks like what I need:
Code: |
<SomeElement xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SomeSchema.xsd">
|
I know I've seen statements on the forum that one cannot use 'XMLNSC.Attribute' in MRM domain as it is a correlation name in XMLNSC domain, not in MRM. However, the code above seems to work for me in MRM and that's the only way I know to get what I need so far.
Thanks |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 25, 2008 1:54 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I know I've seen statements on the forum that one cannot use 'XMLNSC.Attribute' in MRM domain as it is a correlation name in XMLNSC domain, not in MRM. However, the code above seems to work for me in MRM |
Remove the '(XMLNSC.Attribute)'. You will get *exactly* the same output. The MRM XML parser does not even look at the field type when serializing the message tree.
In fact, you do not even need the {} around the namespace prefix. The attribute 'noNamespaceSchemaLocation' is not a special attribute. It is just an attribute with a namespace. So this code is simpler and less confusing to readers of this thread:
Code: |
DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.MRM.xsi:noNamespaceSchemaLocation = 'SomeSchema.xsd'; |
The moral of this story is - try the simple solution first. |
|
Back to top |
|
 |
cjr8020 |
Posted: Tue Nov 25, 2008 5:18 pm Post subject: |
|
|
Newbie
Joined: 25 Sep 2006 Posts: 8
|
Indeed. This code is simpler and works just as well.
Thanks, kimbert. |
|
Back to top |
|
 |
|