ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Namespace prefix using ESQL

Post new topic  Reply to topic Goto page 1, 2  Next
 Namespace prefix using ESQL « View previous topic :: View next topic » 
Author Message
kirank
PostPosted: Wed May 13, 2009 10:27 am    Post subject: Namespace prefix using ESQL Reply with quote

Centurion

Joined: 10 Oct 2002
Posts: 136
Location: California

I have a compute node where I am declaring namespace using ESQL as

DECLARE sh NAMESPACE 'http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader';

However at run time Broker puts the prefix as NS1 instead of sh I declared. Is there any way to force what we want rather than a numbered prefix?

Regards

Kiran
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed May 13, 2009 11:12 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

DECLARE NAMESPACE tells ESQL how to interpret your namespace qualifier.

The only way to control namespace prefixes in XML is to specify them in the XML document.
Back to top
View user's profile Send private message
recallsunny
PostPosted: Wed May 13, 2009 11:38 am    Post subject: Reply with quote

Disciple

Joined: 15 Jun 2005
Posts: 163
Location: Massachusetts

Why would you want to force a certain prefix instead of the standard one generated by Broker? It beats the purpose of XML & Namespaces imo.
Back to top
View user's profile Send private message
broker_new
PostPosted: Wed May 13, 2009 12:28 pm    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

Post the ESQL please, will be easy to reply with the solution
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed May 13, 2009 12:33 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The solution is to set an XML NameSpace Declaration in the output XML document.
Back to top
View user's profile Send private message
kirank
PostPosted: Wed May 13, 2009 12:38 pm    Post subject: Reply with quote

Centurion

Joined: 10 Oct 2002
Posts: 136
Location: California

I know most XML validators should be able handle namespace as long as value is right and the prefix can be anything. The data is sent to External Party and I am not sure how they parse this XML. But they came back to me saying the prefix is not right.

After declaring the Namespace prefix I use it in ESQL as below to set Root tag.

SET OutputRoot.XMLNS.sh:StandardBusinessDocument.sh:StandardBusinessDocumentHeader.sh:HeaderVersion = '1.0';

This produces Output XML root tag as below

<NS1:StandardBusinessDocument xmlns:NS1="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader">

I think their system should be able to handle it. They have not yet loaded it. But I am being proactive and want to know if there is any way of enforcing a value we want.

Regards

Kiran
Back to top
View user's profile Send private message
recallsunny
PostPosted: Wed May 13, 2009 12:43 pm    Post subject: Reply with quote

Disciple

Joined: 15 Jun 2005
Posts: 163
Location: Massachusetts

The brute way of forcing this is to change the domain to non XMLNSC so that broker doesn't acknowledge the namespace declarations. By doing this, you're choosing a less efficient parser.
Back to top
View user's profile Send private message
broker_new
PostPosted: Wed May 13, 2009 12:50 pm    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

I agree in this case but when using namespaces certain times we must use "XMLNS" domain.

kirank use this...

SET OutputRoot.XMLNS.sh:StandardBusinessDocument.(XML.NamespaceDecl)xmlns:"sh" = 'http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader';
SET OutputRoot.XMLNS.sh:StandardBusinessDocument.sh:StandardBusinessDocumentHeader.sh:HeaderVersion = '1.0';
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed May 13, 2009 12:54 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

broker_new wrote:
I agree in this case but when using namespaces certain times we must use "XMLNS" domain.

Always use XMLNSC.
Back to top
View user's profile Send private message
broker_new
PostPosted: Wed May 13, 2009 1:06 pm    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

I remember i had a problem with namespaces longtime back and tried all the possible ways using XMLNSC but didn't work at all..switched to XMLNS worked like a charm.

http://www.mqseries.net/phpBB2/viewtopic.php?t=44245&highlight=&sid=ed9d78fc525dcc573ae7e141ccc5828c
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed May 13, 2009 1:15 pm    Post subject: Re: Namespace prefix using ESQL Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

mqjeff wrote:
broker_new wrote:
I agree in this case but when using namespaces certain times we must use "XMLNS" domain.

Always use XMLNSC.

Always? The WMB documentation offers slightly different advice:
Quote:
Tip: If you require message tree to conform as closely as possible to the XML data model, perhaps because you are using certain XPath expressions to access the message tree, use the XMLNS domain.

Please elaborate.
Back to top
View user's profile Send private message
recallsunny
PostPosted: Wed May 13, 2009 1:18 pm    Post subject: Reply with quote

Disciple

Joined: 15 Jun 2005
Posts: 163
Location: Massachusetts

broker_new wrote:
I remember i had a problem with namespaces longtime back and tried all the possible ways using XMLNSC but didn't work at all..switched to XMLNS worked like a charm.




The XMLNSC parser has a new architecture that gives significant performance improvements over the XMLNS and XML parsers

XMLNSC is the way to go.
Back to top
View user's profile Send private message
broker_new
PostPosted: Wed May 13, 2009 1:23 pm    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

I totally agree with you... but can you tell me how you would resolve this using XMLNSC parser.

The output should look like this.

<Information xmlns="" xmlns="http://www.ibm.com">
<userId>34566775</userId>
</Information >
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed May 13, 2009 1:35 pm    Post subject: Re: Namespace prefix using ESQL Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

rekarm01 wrote:
mqjeff wrote:
broker_new wrote:
I agree in this case but when using namespaces certain times we must use "XMLNS" domain.

Always use XMLNSC.

Always? The WMB documentation offers slightly different advice:
Quote:
Tip: If you require message tree to conform as closely as possible to the XML data model, perhaps because you are using certain XPath expressions to access the message tree, use the XMLNS domain.

Please elaborate.


Fine.

Always use XMLNSC unless you know exactly why you aren't using it.
Back to top
View user's profile Send private message
kirank
PostPosted: Wed May 13, 2009 4:14 pm    Post subject: Reply with quote

Centurion

Joined: 10 Oct 2002
Posts: 136
Location: California

Thanks broker_new. Your solution worked.

Regards

Kiran
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Namespace prefix using ESQL
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.