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 » Accessing Input Namespace

Post new topic  Reply to topic
 Accessing Input Namespace « View previous topic :: View next topic » 
Author Message
KIT_INC
PostPosted: Mon Mar 29, 2010 6:44 am    Post subject: Accessing Input Namespace Reply with quote

Knight

Joined: 25 Aug 2006
Posts: 589

I am using Broker V61 on windows. I have to create an XML output from a field in the XML input message.

The INput message is like
<?xml version="1.0" encoding="UTF-8"?>
<CCWEB DocVersion="4.0" Created="03/1/2010 8:51:44 AM" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns="x-schema:CCWEBSchema.xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="x-schema:CCWEBSchema.xml C:\DOCUME~1\CCWEB.xsd">
<Categories>
<Category CategoryID="1000001" Name="HOTEL SERVICE" />
</Categories>
</CCWEB>

The flow is a simple MQINPUT-TRACE-COMPUTE-MQOUTPUT
The Input is just using XMLNS because I have no schema.


My ESQL is like
DECLARE SP1 NAMESPACE 'x-schema:CCWEBSchema.xml';
SET OutputRoot.XMLNS.NS_TEST.DATA=InputRoot.XMLNS.SP1:CCWEB.SP1:Categories.SP1:Category.Name;

This works and the output looks like
<NS_TEST DATA="HOTEL SERVICE"/>

But my ESQL has to know the NAMESPACE ahead of time. Can I get the namespace dynamically from Input?

I am new to Namespace. I am not sure if I am asking stupid question. If I am right the namspace comes from the XML decl of the incoming message. But I have a hard trying to figure out how to pick up the Namespace information from InputRoot.XMLNS
Looking at the trace output, the root element is already qualified with the NS (x-schema:CCWEBSchema.xml:CCWEB ).

Is the Input data correct ? If so, am I asking for something not normal practice?

This is what shows in the TRACE
(0x01000010:ParserRoot):XMLNS = ( ['xmlns' : 0x771a4b8]
(0x05000018:XmlDecl ):XML = (
(0x06000011:Version ): = '1.0' (CHARACTER)
(0x06000012:Encoding): = 'UTF-8' (CHARACTER)
)
(0x06000002:WhiteSpace): = '
' (CHARACTER)
(0x01000000:Element )x-schema:CCWEBSchema.xml:CCWEB = (
(0x03000000:Attribute ):DocVersion = '4.0' (CHARACTER)
(0x03000000:Attribute ):Created = '12/1/2009 8:51:44 AM' (CHARACTER)
(0x07000012:NamespaceDecl)xmlns:msxsl = 'urn:schemas-microsoft-com:xslt' (CHARACTER)
(0x07000012:NamespaceDecl):xmlns = 'x-schema:CCWEBSchema.xml' (CHARACTER)
(0x07000012:NamespaceDecl)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance' (CHARACTER)
(0x03000000:Attribute )http://www.w3.org/2001/XMLSchema-instance:schemaLocation = 'x-schema:CCWEBSchema.xml C:\DOCUME~1\CCWEB.xsd' (CHARACTER)
(0x02000000:pcdata ): = '
' (CHARACTER)
(0x01000000:Element )x-schema:CCWEBSchema.xml:Categories = (
(0x02000000:pcdata ): = '
' (CHARACTER)
(0x01000000:Element)x-schema:CCWEBSchema.xml:Category = (
(0x03000000:Attribute):CategoryID = '1000001' (CHARACTER)
(0x03000000:Attribute):Name = 'HOTEL SERVICE' (CHARACTER)
)
(0x02000000:pcdata ): = '
' (CHARACTER)
)
(0x02000000:pcdata ): = '
' (CHARACTER)
)
)
);
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Mar 29, 2010 6:51 am    Post subject: Re: Accessing Input Namespace Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

KIT_INC wrote:
The flow is a simple MQINPUT-TRACE-COMPUTE-MQOUTPUT
The Input is just using XMLNS because I have no schema.


That's no reason not to be using XMLNSC

KIT_INC wrote:
Can I get the namespace dynamically from Input?


Try this
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
KIT_INC
PostPosted: Mon Mar 29, 2010 7:40 am    Post subject: Reply with quote

Knight

Joined: 25 Aug 2006
Posts: 589

I tried.
-FIELDNAMESPACE--(--FieldReference--)

But the FieldReference without specifying the Namespace result in
" Failed to navigate to path element number '3' because it does not exist."

This is just a test run, I'll switch to XMLNSC when I start the real coding. I think what I have seen so far should makes no difference if I am using XMLNSC instead of XMLNS.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Mar 29, 2010 7:49 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

KIT_INC wrote:
" Failed to navigate to path element number '3' because it does not exist."


Well clearly you have to try to find the namespace of an element that exists.

KIT_INC wrote:
This is just a test run, I'll switch to XMLNSC when I start the real coding. I think what I have seen so far should makes no difference if I am using XMLNSC instead of XMLNS.


Wrong. XMLNSC uses different constants, so if you're trying to navigate the message tree (to locate an element and determine it's namespace for instance) you have to use the right constants.

You'll also find XMLNSC easier to use for what you're trying to do. There's one key difference in logic terms between XNLNS & XMLNSC....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Mar 29, 2010 7:50 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

A simple search of this forum gives this

http://www.mqseries.net/phpBB2/viewtopic.php?t=52507

Perhaps this is what you want?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Mar 29, 2010 7:53 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Throwing fish?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Mar 29, 2010 8:11 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

As you found out you can move a reference around and not worry about namespace, and discover it using the fieldnamespace function.
You can also use a wildcard for the namespace, to substitute for any namespace... You cannot do this while creating the tree, only when reading the tree... Look it up in the manuals.
Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
KIT_INC
PostPosted: Tue Mar 30, 2010 7:48 am    Post subject: Reply with quote

Knight

Joined: 25 Aug 2006
Posts: 589

Using wild card and then FIELDNAMESPACE works. Thanks a lot.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Accessing Input Namespace
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.