Author |
Message
|
mbsa |
Posted: Thu Apr 17, 2014 12:21 pm Post subject: Namespace defaulting |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
Hello ,
I am using wmb 7.0.
i am declaring a NS as
Code: |
DECLARE SVar SHARED ROW;
DECLARE hns NAMESPACE 'urn:com/uts/services/Aderhead';
SET OutputRoot.XMLNSC.hns:Root = SVar.XMLNSC.hns:Root;
|
The output i am getting as
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<NS1:Root xmlns:NS1="urn:com/uts/services/Aderhead">
<NS1:CorrespondenceRequest>
<NS1:requestDetails>
|
why the NS is NS1 instead of hns?
How do i get it to be hns? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Apr 17, 2014 2:23 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You need to add a namespace declaration into OutputRoot.XMLNSC. The ESQL constant only affects your ESQL code - not the XML output.
Search for 'XMLNSC namespace declaration' in the info center. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
mbsa |
Posted: Fri Apr 18, 2014 4:13 am Post subject: |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
Thanks for the reply. I do have namespace declaration into OutputRoot.XMLNSC.
Code: |
DECLARE SVar SHARED ROW;
DECLARE hns NAMESPACE 'urn:com/uts/services/Aderhead';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
SET OutputRoot.XMLNSC.hns:Root.(XMLNSC.NamespaceDecl)xmlns:hns ='urn:com/uts/services/Aderhead';
SET OutputRoot.XMLNSC.hns:Root = SVar.XMLNSC.hns:Root;
|
Still the output is
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<NS1:Root xmlns:NS1="urn:com/uts/services/Aderhead">
<NS1:CorrespondenceRequest>
<NS1:requestDetails>
|
|
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Apr 18, 2014 4:53 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
mbsa wrote: |
Thanks for the reply. I do have namespace declaration into OutputRoot.XMLNSC.
Code: |
DECLARE SVar SHARED ROW;
DECLARE hns NAMESPACE 'urn:com/uts/services/Aderhead';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
SET OutputRoot.XMLNSC.hns:Root.(XMLNSC.NamespaceDecl)xmlns:hns ='urn:com/uts/services/Aderhead';
SET OutputRoot.XMLNSC.hns:Root = SVar.XMLNSC.hns:Root;
|
Still the output is
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<NS1:Root xmlns:NS1="urn:com/uts/services/Aderhead">
<NS1:CorrespondenceRequest>
<NS1:requestDetails>
|
|
your hns is ambiguous....
Have you tried
Code: |
SET OutputRoot.XMLNSC.hns:Root.(XMLNSC.NamespaceDecl)xmlns:"hns" ='urn:com/uts/services/Aderhead'; |
Note the quotes around hns in the declaration...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mbsa |
Posted: Fri Apr 18, 2014 6:51 am Post subject: |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
I used this code
Code: |
SET OutputRoot.XMLNSC.hns:Root.(XMLNSC.NamespaceDecl)xmlns:"hns" ='urn:com/uts/services/Aderhead';
|
But still the same response
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<NS1:Root xmlns:NS1="urn:com/aes/services/thunderhead">
<NS1:CorrespondenceRequest>
<NS1:requestDetails>
|
[/code] |
|
Back to top |
|
 |
Tibor |
Posted: Fri Apr 18, 2014 7:31 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
"hns" is only the name of your namespace variable, not a label. That's why it is simply substituted with NS1, NS2, etc. Please check again what kimbert wrote you.
Anyway, what is the problem with the output XML? Based on the standard, it is correct for a namespace aware XML parser. |
|
Back to top |
|
 |
mbsa |
Posted: Fri Apr 18, 2014 8:57 am Post subject: |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
Tibor,
There is no issue with the xml.
The target application wants the namespace to be "hns" only.
Can you be more specific about the label you mentioned before.Thanks. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Apr 18, 2014 12:57 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The ESQL that your flow is executing is not the ESQL that you have posted. Redeploy, and try again.
If you still cannot make it work then create a test flow containing an MQInput node and a Trace node. Parse the XML that you want to create, and look at the Trace node output. Then adjust your message flow until it creates exactly the same message tree. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
mbsa |
Posted: Tue Apr 22, 2014 4:21 am Post subject: |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
I got the correct NS. The issue was after building the NS in the Root i was overlapping it with the tree structure in my shared variables. That was the reason why it is taking the default NS1.
Code: |
SET OutputRoot.XMLNSC.hns:Root = SVar.XMLNSC.hns:Root;
|
Code: |
SET OutputRoot.XMLNSC.hns:Root.hns:HR = SVar.XMLNSC.hns:Root.hns:HR ;
|
Thanks for all the replies. |
|
Back to top |
|
 |
|