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 » XMLNSC.Element field type constant functioning correctly?

Post new topic  Reply to topic Goto page 1, 2  Next
 XMLNSC.Element field type constant functioning correctly? « View previous topic :: View next topic » 
Author Message
Sandman
PostPosted: Fri Nov 18, 2011 10:37 am    Post subject: XMLNSC.Element field type constant functioning correctly? Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

Hi,

I have already spent some time searching this forum for answers and reading about similar issues, but to no avail.

Using version/build 6.1.0.7-20100428-0908. Simple flow with just an MQInput, Compute and a couple Trace nodes. (Yes, my MQInput node's Message Domain is set to "XMLNSC". )

My problem is that the field type constant "XMLNSC.Element" doesn't seem to work as expected.

Input:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<Message>
 <Parent a1="attribute 1" a2="attribute 2">
  <e1>element 1</e1>
 </Parent>
</Message>

ESQL:
Code:
CREATE COMPUTE MODULE Test_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
      CALL CopyMessageHeaders();
      -- CALL CopyEntireMessage();
      DECLARE inMsg REFERENCE TO InputRoot.XMLNSC.Message;
      CREATE FIELD OutputRoot.XMLNSC.Message;
      DECLARE outMsg REFERENCE TO OutputRoot.XMLNSC.Message;
      DECLARE children INT CARDINALITY(inMsg.Parent.[]);
      DECLARE i INT 1;
      WHILE i <= children DO
         SET outMsg.Children.{CAST(i AS CHAR)}.FieldName = FIELDNAME(inMsg.Parent.[i]);
         SET outMsg.Children.{CAST(i AS CHAR)}.FieldType = FIELDTYPE(inMsg.Parent.[i]);
         SET outMsg.Children.{CAST(i AS CHAR)}.FieldValue = FIELDVALUE(inMsg.Parent.[i]);
         SET i = i + 1;
      END WHILE;
      SET outMsg.ElementCardinality = CARDINALITY(inMsg.Parent.(XMLNSC.Element)*[]);
      SET outMsg.FieldCardinality = CARDINALITY(inMsg.Parent.(XMLNSC.Field)*[]);
      SET outMsg.AttributeCardinality = CARDINALITY(inMsg.Parent.(XMLNSC.Attribute)*[]);

Trace Output:
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0x5373538]
(0x01000000:Folder):Message = (
(0x01000000:Folder ):Children = (
(0x01000000:Folder):1 = (
(0x03000000:PCDataField):FieldName = 'a1' (CHARACTER)
(0x03000000:PCDataField):FieldType = 50331904 (INTEGER) Translates to X'3000100' = XMLNSC.Attribute
(0x03000000:PCDataField):FieldValue = 'attribute 1' (CHARACTER)
)
(0x01000000:Folder):2 = (
(0x03000000:PCDataField):FieldName = 'a2' (CHARACTER)
(0x03000000:PCDataField):FieldType = 50331904 (INTEGER) Translates to X'3000100' = XMLNSC.Attribute
(0x03000000:PCDataField):FieldValue = 'attribute 2' (CHARACTER)
)
(0x01000000:Folder):3 = (
(0x03000000:PCDataField):FieldName = 'e1' (CHARACTER)
(0x03000000:PCDataField):FieldType = 50331648 (INTEGER) Translates to X'3000000' = XMLNSC.Field
(0x03000000:PCDataField):FieldValue = 'element 1' (CHARACTER)
)
)
(0x03000000:PCDataField):ElementCardinality = 0 (INTEGER) Shouldn't all Fields also count as Elements???
(0x03000000:PCDataField):FieldCardinality = 1 (INTEGER)
(0x03000000:PCDataField):AttributeCardinality = 2 (INTEGER)
)
)
)

According to the Info Center:
Quote:
XMLNSC.Element Matches any tag, whether it contains child tags (XMLNSC.Folder) or a value (XMLNSC.Field )


Please ?
Thank you.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Fri Nov 18, 2011 3:02 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Thanks for a clear problem description. The answer is in there, but easy to miss. Please refer to this topic in the info center: http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ac67192_.htm
where it says:
Quote:
Field types for path expressions ( generic field types )
Use the following field type constants when querying the message tree by using a path expression; for example:
In other words, these fields types are for *querying* the message tree, not for building it. The field type constant 'XMLNSC.Element' allows you to *match* either a simple element ( XMLNSC.PCDataField ) or a complex element ( XMLNSC.Folder ). Or in XML terms, it matches anything that is a tag.

When you are creating an element and specifying its field type you should use one of the specific field types - XMLNSC.PCDataField or XMLNSC.Folder. But note that you can get away with not specifying the field type in most situations - the default is XMLNSC.Folder, and it will automatically change to XMLNSC.PCDataField if you assign a value to the element.

One final point: the table at the top of that topic is wrong. It should not be advising you to *create* a field using XMLNSC.Field. You should use XMLNSC.PCDataField ( usually not necessary ) or XMLNSC.CDataField.
Back to top
View user's profile Send private message
Sandman
PostPosted: Mon Nov 21, 2011 7:27 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

The link you provided is exactly where I took my quote from:
Quote:
XMLNSC.Element Matches any tag, whether it contains child tags (XMLNSC.Folder) or a value (XMLNSC.Field )

Unless I'm completely misunderstanding something, I think my code IS "querying" the tree, not building it. My use of XMLNSC.Element in the 3 cardinality statements is on the right side of the SET statement and performed upon the Input tree.

I could've just as easily set declared variables instead of Output tree elements, but I wanted the output to show up in my Trace output.

What am I missing? Thank you.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Mon Nov 21, 2011 8:31 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

You're right - I missed the point completely there, despite the fact that you highlighted it in red

Not sure why
Code:
SET outMsg.ElementCardinality = CARDINALITY(inMsg.Parent.(XMLNSC.Element)*[]);
is not returning 1. It certainly should do so.

I would be interested to know what result you get from this:
Code:
SET outMsg.e1 = inMsg.Parent.(XMLNSC.Element)e1;
You *should* get a copy of e1 in the output tree.
Back to top
View user's profile Send private message
Sandman
PostPosted: Mon Nov 21, 2011 8:49 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

No problem. I appreciate all you do to help out here and it's understandable that you could overlook that late on a Friday afternoon.

Yes, I do get a copy of e1 in the output tree from that statement.

Trace Output:
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0xd2f6f8]
(0x01000000:Folder):Message = (
(0x01000000:Folder ):Children = (
(0x01000000:Folder):1 = (
(0x03000000:PCDataField):FieldName = 'a1' (CHARACTER)
(0x03000000:PCDataField):FieldType = 50331904 (INTEGER)
(0x03000000:PCDataField):FieldValue = 'attribute 1' (CHARACTER)
)
(0x01000000:Folder):2 = (
(0x03000000:PCDataField):FieldName = 'a2' (CHARACTER)
(0x03000000:PCDataField):FieldType = 50331904 (INTEGER)
(0x03000000:PCDataField):FieldValue = 'attribute 2' (CHARACTER)
)
(0x01000000:Folder):3 = (
(0x03000000:PCDataField):FieldName = 'e1' (CHARACTER)
(0x03000000:PCDataField):FieldType = 50331648 (INTEGER)
(0x03000000:PCDataField):FieldValue = 'element 1' (CHARACTER)
)
)
(0x03000000:PCDataField):ElementCardinality = 0 (INTEGER)
(0x03000000:PCDataField):FieldCardinality = 1 (INTEGER)
(0x03000000:PCDataField):AttributeCardinality = 2 (INTEGER)
(0x03000000:PCDataField):e1 = 'element 1' (CHARACTER) )
)
)
Back to top
View user's profile Send private message Send e-mail
Sandman
PostPosted: Tue Nov 22, 2011 8:00 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

kimbert,

Should I open a ticket with IBM Support for this or are you still looking into it on your end?

Thank you.
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Nov 22, 2011 8:07 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Sandman wrote:
kimbert,

Should I open a ticket with IBM Support for this or are you still looking into it on your end?

Thank you.


If you need official help, including code fixes, you always have to open a ticket with IBM Support.

it may be useful to include a link to this thread on mqseries.net in said ticket, however.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Nov 22, 2011 8:12 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

both
Back to top
View user's profile Send private message
Sandman
PostPosted: Tue Nov 22, 2011 8:58 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

Will do. Thank you.
Back to top
View user's profile Send private message Send e-mail
Sandman
PostPosted: Wed Dec 07, 2011 12:47 pm    Post subject: Update from IBM Support Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

DELETED

Last edited by Sandman on Thu Dec 08, 2011 6:08 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Wed Dec 07, 2011 2:36 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Please do not make a habit of posting your private conversations with IBM support on a public forum. I suspect you may be breaching the terms of your agreement with IBM by doing so.
Back to top
View user's profile Send private message
Sandman
PostPosted: Thu Dec 08, 2011 6:10 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

Oh, I thought I was just helping the community by offering an update - which I'm not really sure how to provide without quoting or paraphrasing at least part of what they said.

No problem. I'll get the answer from them and not share it.
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Thu Dec 08, 2011 6:14 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Sandman wrote:
Oh, I thought I was just helping the community by offering an update - which I'm not really sure how to provide without quoting or paraphrasing at least part of what they said.

No problem. I'll get the answer from them and not share it.


I think the suggestion is to paraphrase rather than directly quote.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Dec 08, 2011 6:18 am    Post subject: Reply with quote

Grand High Poobah

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

Sandman wrote:
I'm not really sure how to provide without quoting or paraphrasing at least part of what they said.


And paraphrasing is bad because....?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sandman
PostPosted: Thu Dec 08, 2011 6:21 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

There really wasn't anything specific about our company data in the response I posted or anything other than them asking if I could wait a few weeks for another [likely final] response. Nor did I provide anyone's names or email addresses, etc.

Beyond that, paraphrasing the details of their response seemed like a waste of time. They provided a thorough answer; why would I want to risk messing it up by putting it into my own words?
Back to top
View user's profile Send private message Send e-mail
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 » XMLNSC.Element field type constant functioning correctly?
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.