Author |
Message
|
special_agent_Queue |
Posted: Wed Oct 11, 2006 7:21 am Post subject: XMLNSC.Field (fieldtypes) issue |
|
|
 Centurion
Joined: 27 Jul 2006 Posts: 102
|
v6, xmlnsc parser
I want to handle fields differently than attributes. Therefore, I am using the FIELDTYPE function to make a comparison.
If FIELDTYPE(SomePointer) = XMLNSC.Field THEN
do something
ELSE
do something
END IF;
The problem is is that it is not evaluating properly. It appears that XMLNSC.Field, which is supposed to be a constant that resolves to an INTEGER is not working correctly. I have set up temporary variables to see what is going on.
In the debugger-
FIELDTYPE(SomePointer) evaluates to 16777216
The variable I set to XMLNSC.Field just shows blank.
I also created some other variables to test.
XMLNSC.Attribute also shows blank.
NameValue, however, shows 50331648
Anyone heard of a reason/know why the XMLNSC type integers are showing blank?
Thanks! |
|
Back to top |
|
 |
special_agent_Queue |
Posted: Wed Oct 11, 2006 10:40 am Post subject: |
|
|
 Centurion
Joined: 27 Jul 2006 Posts: 102
|
There isn't much documentation on this, it really only gives you a list of constant names.
Am I using them right?
Or do I need to do something along the lines of:
IF FIELDTYPE(SomePointer) IN (0x01000000, 0x03000000) ? |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Oct 11, 2006 7:29 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi special_agent_Queue,
Could you paste your actual code...and the sample input.
What is "integer" in XMLNSC.Field, its value or the type ?
Regards. |
|
Back to top |
|
 |
special_agent_Queue |
Posted: Thu Oct 12, 2006 5:02 am Post subject: |
|
|
 Centurion
Joined: 27 Jul 2006 Posts: 102
|
Here's the code I was just testing with:
Code: |
CREATE PROCEDURE AddPrefixes(IN StartPtr REFERENCE, IN NewSubTree REFERENCE, IN Prefix CHAR, IN GoToChildren BOOLEAN, IN GoToSibling BOOLEAN)
BEGIN
DECLARE Pointer REFERENCE TO StartPtr;
DECLARE NewPointer REFERENCE TO NewSubTree;
DECLARE Pre CHAR Prefix;
DECLARE Children BOOLEAN GoToChildren;
DECLARE Sib BOOLEAN GoToSibling;
DECLARE KeepGoing BOOLEAN true;
DECLARE FName CHARACTER;
DECLARE EvalFname CHARACTER;
DECLARE fldType INTEGER FIELDTYPE(Pointer);
DECLARE fld INTEGER XMLNSC.Field; |
Here's the code I am actually using (cut down a bit):
Code: |
CREATE PROCEDURE AddPrefixes(IN StartPtr REFERENCE, IN NewSubTree REFERENCE, IN Prefix CHAR, IN GoToChildren BOOLEAN, IN GoToSibling BOOLEAN)
BEGIN
DECLARE Pointer REFERENCE TO StartPtr;
DECLARE NewPointer REFERENCE TO NewSubTree;
DECLARE Pre CHAR Prefix;
DECLARE Children BOOLEAN GoToChildren;
DECLARE Sib BOOLEAN GoToSibling;
DECLARE KeepGoing BOOLEAN true;
DECLARE FName CHARACTER;
DECLARE EvalFname CHARACTER;
WHILE LASTMOVE(Pointer) AND KeepGoing DO
IF FIELDTYPE(Pointer) = XMLNSC.Field THEN
SET FName = FIELDNAME(Pointer);
IF FName = 'ServiceProviderRole' OR FName = 'AttorneyRole' OR FName = 'lossLocation'
OR FName = 'InvolvedPartyRole' OR FName = 'AdjusterRole' OR FName = 'treatingPhysician'
OR FName = 'PolicyCoverages' OR FName = 'SalvageRole' OR FName = 'FileHandlers' THEN
MOVE Pointer NEXTSIBLING;
ELSE
SET EvalFname = Pre || FName;
CREATE NEXTSIBLING OF NewPointer DOMAIN('XMLNSC') NAME EvalFname
VALUE FIELDVALUE(Pointer);
DECLARE TempPointer REFERENCE TO Pointer;
MOVE TempPointer NEXTSIBLING;
MOVE Pointer TO TempPointer;
MOVE NewPointer NEXTSIBLING;
END IF;
ELSE
MOVE Pointer NEXTSIBLING;
END IF;
END WHILE; |
Sample Input:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<Correspondence>
<cor:to id="P001"/>
<cor:from id="P002"/>
<cor:cc id="P001"/>
<cor:bcc id="P001"/>
<cor:formName/>
<cor:Document>
<cor:type/>
<cor:name/>
<cor:description/>
<cor:author id="P002"/>
<cor:status/>
<cor:securityType/>
</cor:Document>
<cor:Attachments>
<cor:Attachment>
<cor:KeyGroup id="K003" keyGroupType="Document">
<AlternateId state="exists" value="0003" sourceLogicalId="DC"/>
</cor:KeyGroup>
<cor:type/>
<cor:name/>
</cor:Attachment>
</cor:Attachments>
</Correspondence>
<Claim><clm:fileNumber/>
<clm:AttorneyRole>
<clm:Attorney>
<ptyimpl:IndividualImpl pid="P001" refid="KG001">
<impl:effectiveDate>2006-09-11</impl:effectiveDate>
<impl:processDate>2006-09-10</impl:processDate>
<impl:KeyGroup id="K001" keyGroupType="Company" refid="KG001">
<AlternateId state="exists" value="0001" sourceLogicalId="AB"/>
</impl:KeyGroup>
<ptyimpl:Individual PID="P00">
<pty:KeyGroup id="K008" keyGroupType="Company" refid="KG001">
<AlternateId state="exists" value="0001" sourceLogicalId="AB"/>
<UUID/>
</pty:KeyGroup>
<pty:ContactPointUsages>
<pty:ContactPointUsage contactPointID="CP004">
<loc:use>Professional</loc:use>
<loc:availability/>
<loc:preferredTime/>
<loc:fromMonth/>
<loc:fromDay/>
<loc:toMonth/>
<loc:toDay/>
<loc:Email contactPointID="CP004">
<loc:location/>
</loc:Email>
</pty:ContactPointUsage>
</pty:ContactPointUsages>
<pty:title/>
<pty:firstName/>
<pty:middleName/>
<pty:lastName/>
<pty:suffix/>
<pty:comments/>
</ptyimpl:Individual>
</ptyimpl:IndividualImpl>
</clm:Attorney>
</clm:AttorneyRole> |
I cut the input down, because there's just too much to post. The input message has the namespaces stripped, some fields are copied to other places in the tree, and then it goes to the procedure posted above.
Everything works as I expect, except for the fact that it will not enter the IF FIELDTYPE(Pointer) = XMLNSC.Field THEN...
If I comment it out, then I am able to complete the procedure, and the pointer works correctly.
From http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.msgbroker.helphome.doc/help_home_msgbroker.htm&tab=search&searchWord=PROPAGATE+to+LABEL&maxHits=50
my code should work.
Quote: |
FIELDTYPE returns an integer representing the type of the field identified by source_field_reference; this is the type of the field, not the data type of the field that the parameter identifies. If the parameter identifies a nonexistent entity, NULL is returned.
The mapping of integer values to field types is not published, and might change from release to release. Compare the results of the FIELDTYPE function with named field types.
For example:
IF FIELDTYPE(source_field_reference) = NameValue
THEN ...
The named field types that you can use in this context are listed below. |
elvis, if you can help, that's great, otherwise I'll just use that IN (0x01.....) thing, seeing as how I am already using it in a StripNamespaces procedure (also found on this forum). |
|
Back to top |
|
 |
special_agent_Queue |
Posted: Wed Oct 18, 2006 6:12 am Post subject: |
|
|
 Centurion
Joined: 27 Jul 2006 Posts: 102
|
I went ahead and decided to use IF FIELDTYPE(SomePointer) IN (0x01000000, 0x03000000). That works fine. Still not sure why the other way doesn't work, because it should. According to IBM, we shouldn't use the above code because the values could get changed in later releases. Oh well. Just one small problem of the many encountered with version 6. |
|
Back to top |
|
 |
Yaroslav |
Posted: Wed Oct 18, 2006 12:20 pm Post subject: |
|
|
Novice
Joined: 28 Sep 2006 Posts: 12 Location: Russia
|
Hi, special_agent_Queue!
As seems to me, cause of problem in that you don't differ XMLNSC.Field and XMLNSC.Folder types.
XMLNSC.Field -This is the specific type value for an optimized XML element containing a text value only.
XMLNSC.Folder - This is the specific type value for an XML element that contains more than just a text node (element content).
For example, type of element "AttorneyRole" isn't XMLNSC.Field, because it has child elements. _________________ IBM Certified Solution Designer WebSphere MQ V6.0
IBM Certified Solution Developer WebSphere Message Broker V6.0 |
|
Back to top |
|
 |
special_agent_Queue |
Posted: Thu Oct 19, 2006 4:44 am Post subject: |
|
|
 Centurion
Joined: 27 Jul 2006 Posts: 102
|
That may be my problem, but that still doesn't explain why it showed up blank when I set variable equal to it.
Thanks for your reply. |
|
Back to top |
|
 |
Yaroslav |
Posted: Thu Oct 19, 2006 5:24 am Post subject: |
|
|
Novice
Joined: 28 Sep 2006 Posts: 12 Location: Russia
|
Sorry, I only tryed to aswer on this:
Quote: |
Everything works as I expect, except for the fact that it will not enter the IF FIELDTYPE(Pointer) = XMLNSC.Field THEN... |
As to
Quote: |
Anyone heard of a reason/know why the XMLNSC type integers are showing blank? |
I don't know. It sounds like bug or feature of debugger/broker. _________________ IBM Certified Solution Designer WebSphere MQ V6.0
IBM Certified Solution Developer WebSphere Message Broker V6.0 |
|
Back to top |
|
 |
special_agent_Queue |
Posted: Thu Oct 19, 2006 5:31 am Post subject: |
|
|
 Centurion
Joined: 27 Jul 2006 Posts: 102
|
That's ok. Thanks for the answer. I'll just keep it the way I have it for now, at least it's consistent with other procedures. |
|
Back to top |
|
 |
|