Author |
Message
|
vasanthi |
Posted: Thu Aug 11, 2005 1:50 pm Post subject: referencing namespace elements |
|
|
Apprentice
Joined: 23 Apr 2005 Posts: 42
|
Hi
i have created a message set which has namespaces enabled.i have created this message set based on schema file.
ihave created my flow as
inputnode-->compute node--->trace node----->outputnode
in the input node i have set the domain as MRM because i need to validate the content of the xml message.my input is getting validated.
next in my compute node i need to build an output message.
so i am writing the code as
SET OutputRoot.XML.Struct.id=InputRoot.MRM.id.
but in the output i get only the empty tag <struct>
sample input message:
<?xml version="1.0" encoding="UTF-8"?>
<Event xmlns="http://www.abc.com/temp/eve">
<uid>13</uid>
<id>0</id>
<Event>
i have tried all the options
SET OutputRoot.XML.Struct.id=InputRoot.XMLNS.Event.id;
but still i get the same empty tag <Struct>
so i require some help in this.
regards
vasanthi |
|
Back to top |
|
 |
miracle |
Posted: Thu Aug 11, 2005 2:34 pm Post subject: |
|
|
Newbie
Joined: 11 Aug 2005 Posts: 8
|
Onceagain create messageset with out Namespace aware and use it u will get it. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Aug 12, 2005 12:47 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
miracle |
Posted: Fri Aug 12, 2005 5:30 am Post subject: |
|
|
Newbie
Joined: 11 Aug 2005 Posts: 8
|
See In order to check weather u are getting the message in MRM Domain properly Use flowdebug and put breakpoint in ur flow after Input node and check out the strcture
If the input is InputRoot.MRM.id u can access or if u have namespace for it just use whildcard char. InputRoot.MRM.*:id
it will automatically identifies the element |
|
Back to top |
|
 |
vasanthi |
Posted: Fri Aug 12, 2005 6:15 am Post subject: |
|
|
Apprentice
Joined: 23 Apr 2005 Posts: 42
|
thanks for the responses
as kimbert said i have declared a namespace constant
DECLARE eve NAMESPACE 'http://www.abc.com/temp/eve';
but no luck;
i have tried all these combinations
SET OutputRoot.XML.Struct.id=InputRoot.XMLNS.eve:Event.eve:id;
SET OutputRoot.XML.Struct.id=InputRoot.XMLNS.eve:Event.id;
SET OutputRoot.XML.Struct.id=InputRoot.XMLNS.Event.eve:id;
SET OutputRoot.XML.Struct.id=InputRoot.MRM.Event.id;
and also tried as miracle said
SET OutputRoot.XML.Struct.id=InputRoot.MRM.*:id;
but no luck;
i have created the message set based upon the schema
when i look at the logical properties of the element id i find them as
name==id;
type==int;
namespace='http://www.abc.com/temp/eve';
and i also refered to the link mentioned by kimbert.
in that link the last reply says that
I have to put the default namespace in front of every element that does not have a namespace prefix specified.
i could not understand this.as i am not much familiar with namespaces. can anyone tell what this means put default namespace infront of every element.and how this can be done.
and once again thanks in advance for all the help.
regards
vasanthi |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Aug 12, 2005 6:23 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Use a tracenode to view your input message - configure the node to write to a file using the pattern ${Root}.
Then examine the tree structure that is created by the XMLNS parser, to help you identify the paths you need to use to access the different elements of your incoming message.
Or attach the debugger, and look at Root at a breakpoint right after the input node. But with partial parsing, you might not see the whole message tree. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
vasanthi |
Posted: Fri Aug 12, 2005 6:44 am Post subject: |
|
|
Apprentice
Joined: 23 Apr 2005 Posts: 42
|
thanks jeff
i have changed the domain to xmlns and also placed a trace node after input.
this is the trace i get
(
(0x01000000):Properties = (
(0x03000000):MessageSet = 'evems (KDCH7L0002001)'
(0x03000000):MessageType = 'Event'
(0x03000000):MessageFormat = 'XML1'
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Transactional = TRUE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2005-08-12 14:37:21'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'MQ'
(0x03000000):Topic = NULL
)
(0x01000000):MQMD = (
(0x03000000):SourceQueue = 'EVENT_IN'
(0x03000000):Transactional = TRUE
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Format = ' '
(0x03000000):Version = 2
(0x03000000):Report = 0
(0x03000000):MsgType = 8
(0x03000000):Expiry = -1
(0x03000000):Feedback = 0
(0x03000000):Priority = 0
(0x03000000):Persistence = 0
(0x03000000):MsgId = X'414d51205742524b5f514d20202020205b18f9422000e006'
(0x03000000):CorrelId = X'000000000000000000000000000000000000000000000000'
(0x03000000):BackoutCount = 0
(0x03000000):ReplyToQ = ' '
(0x03000000):ReplyToQMgr = 'WBRK_QM '
(0x03000000):UserIdentifier = 'KalidinK '
(0x03000000):AccountingToken = X'16010515000000aa008001aa521979e91996162087000000000000000000000b'
(0x03000000):ApplIdentityData = ' '
(0x03000000):PutApplType = 11
(0x03000000):PutApplName = 'KalidinK\Desktop\rfhutil.exe'
(0x03000000):PutDate = DATE '2005-08-12'
(0x03000000):PutTime = GMTTIME '14:37:21'
(0x03000000):ApplOriginData = ' '
(0x03000000):GroupId = X'000000000000000000000000000000000000000000000000'
(0x03000000):MsgSeqNumber = 1
(0x03000000):Offset = 0
(0x03000000):MsgFlags = 0
(0x03000000):OriginalLength = -1
)
(0x01000010):XMLNS = (
(0x05000018):XML = (
(0x06000011): = '1.0'
(0x06000012): = 'UTF-8'
)
(0x06000002): = '
'
(0x01000000)http://www.abc.com/temp/eve:Event = (
(0x07000012):xmlns = 'http://www.abc.com/temp/eve'
(0x02000000): = '
'
(0x01000000)http://www.abc.com/temp/eve:uid = (
(0x02000000): = '13'
)
(0x02000000): = '
'
(0x01000000)http://www.abc.com/temp/eve:id = (
(0x02000000): = '0'
)
(0x02000000): = '
'
)
In my ESQl i trie to access it
as
SET OutputRoot.XML.Struct.id=InputRoot.XMLNS.Event.eve:id;
regards
vasanthi |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Aug 12, 2005 7:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You see the tree structure?
You see how every element in the tree structure is qualified by the namespace?
Can you map that back to your ESQL? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
miracle |
Posted: Fri Aug 12, 2005 7:10 am Post subject: |
|
|
Newbie
Joined: 11 Aug 2005 Posts: 8
|
Try This way
In ur Input Node put Domain as MRM in the Default properties and ur message set,message format and in the next compute node
SET OutputRoot.XML.Stru.id=InputRoot.MRM.*:Event.id;
as i have seen ur message there is namespace for event not for Id so u use whild char near Event as i have given above. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Aug 12, 2005 7:12 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
miracle wrote: |
as i have seen ur message there is namespace for event not for Id so u use whild char near Event as i have given above. |
That's not true. Both Event and id are qualified by the namespace, and thus have to be referenced using it. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
miracle |
Posted: Fri Aug 12, 2005 7:49 am Post subject: |
|
|
Newbie
Joined: 11 Aug 2005 Posts: 8
|
I worked by creating messageset with ur sample it worked for me
i amattaching the code
before that kepur MQInput node properties set to MEM in domain and Messageset and Message format to XML1
CREATE COMPUTE MODULE buildResponse_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
DECLARE q1 NAMESPACE 'http://www.abc.com/temp/eve';
SET OutputRoot.XML.event.id=InputRoot.MRM.q1:id;
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE; |
|
Back to top |
|
 |
miracle |
Posted: Fri Aug 12, 2005 7:51 am Post subject: |
|
|
Newbie
Joined: 11 Aug 2005 Posts: 8
|
Sorry its MRM Not MEM wrongly spelt |
|
Back to top |
|
 |
miracle |
Posted: Fri Aug 12, 2005 7:55 am Post subject: |
|
|
Newbie
Joined: 11 Aug 2005 Posts: 8
|
CREATE COMPUTE MODULE buildResponse_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
DECLARE q1 NAMESPACE 'http://www.abc.com/temp/eve';
SET OutputRoot.XML.event.id=InputRoot.MRM.q1:id;
RETURN TRUE;
END;
It worked i have created a message set with sample message u have given
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE; |
|
Back to top |
|
 |
RichA |
Posted: Fri Aug 12, 2005 9:14 am Post subject: |
|
|
 Centurion
Joined: 14 Mar 2002 Posts: 102
|
Netiquette (is that an annoying term?) requires me to point out that when you make spelling mistakes and wish to fix them on a message board there is an edit button that will allow you to modify your post, please be using this instead of additional postings, also it is considered bad form (very british expression?) to post multiple messages with no-one else posting inbetween your messages within the thread. Also is there a reason for posting the entire code twice? |
|
Back to top |
|
 |
vasanthi |
Posted: Fri Aug 12, 2005 9:47 am Post subject: |
|
|
Apprentice
Joined: 23 Apr 2005 Posts: 42
|
thanks guys
i got the output. i have seen the tree stucture in the trace.and then i was able to map it back to ESQl. it comes similar to the example given by miracle.once again thank you guys for helping me out
regards
vasanthi |
|
Back to top |
|
 |
|