|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
XML Attribute gone during assignment |
« View previous topic :: View next topic » |
Author |
Message
|
lium |
Posted: Tue May 04, 2010 7:10 am Post subject: XML Attribute gone during assignment |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
I have message like:
InvoiceLine
Quantity:INTEGER:25
unitCode:CHARACTER:EA
UnitPrice
Amount:DECIMAL:13.15
ExtendedAmount:DECIMAL:263.75
The InvoiceLine is generated in OutputLocalEnvironment as an element of XMLNSC domain, and I want to save it to OutputRoot before the compute node ends.
The unitCode is XML attribute. The problem is the unitCode will be gone during different save approaches. But the Amount which is XML element does not have any problem.
So far , I have tried:
1. Use dynamic reference pointing to InvoiceLine, then DETACH and ATTACH by invoking :
CREATE PROCEDURE AttachChildren(IN initialize BOOLEAN, IN source REFERENCE, INOUT target REFERENCE) BEGIN
IF initialize THEN
RETURN;
END IF;
DECLARE rChild REFERENCE TO source;
DECLARE childNum INT CARDINALITY(source.*[]);
DECLARE hasChild BOOLEAN TRUE;
REPEAT
MOVE rChild LASTCHILD;
SET hasChild = LASTMOVE(rChild);
IF hasChild THEN
DETACH rChild;
ATTACH rChild TO target AS LASTCHILD;
MOVE rChild TO source;
END IF;
UNTIL (NOT hasChild)
END REPEAT;
END;
2. Use Create as last child by invoking:
CREATE PROCEDURE CopyChildren(IN initialize BOOLEAN, IN source REFERENCE, INOUT target REFERENCE) BEGIN
IF initialize THEN
RETURN;
END IF;
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(source.*[]);
WHILE (I <= J) DO
CREATE LASTCHILD OF target FROM source.*[I];
SET I = I + 1;
END WHILE;
END;
3. SET directly with code:
DECLARE I INT 1;
DECLARE J INT CARDINALITY(rLinesForm.InvoiceLine[]);
WHILE I <= J DO
SET rPointer.InvoiceLine[I] = rLinesForm.InvoiceLine[I];
SET I = I + 1;
END WHILE;
All these 3 approaches got the same result, everything is copied correct except the unitCode was gone.
Anyone can help?
Great Thanks |
|
Back to top |
|
 |
kimbert |
Posted: Tue May 04, 2010 7:26 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You may have fallen into a very common trap. When copying data into the Environment or LocalEnvironment tree you need to ensure that the parent element is CREATEd using the DOMAIN clause. This assigns a domain to the parent and ensures that the parser-specific flags ( like the one that indicates an attribute for XMLNSC ) are preserved.
My advice:
- CREATE the parent node in OutputLocalEnvironment with DOMAIN 'XMLNSC'.
- if that doesn't work, either attach the debugger or take a user trace.
- if you can't get it working, post the user trace output here ( and please use [code] tags to make it readable). Add two Trace nodes which trace the input tree and LocalEnvironment so that we can see what the Compute node receives and what it creates. |
|
Back to top |
|
 |
lium |
Posted: Tue May 04, 2010 10:57 am Post subject: |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
Very constructive advice.
It is now working.
Great Thanks |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|