and I'd like to transform this structure in a new structure:
<A>
<W>field1field2field3...</W>
</A>
and I'd like to obtain this new structure using a compute node with generic ESQL code.
I used this instruction:
SET OutputRoot.XML.A.W = BITSTREAM(InputRoot.XML.A);
but the BITSTREAM output is a hexadecimal string.
Then I translated this string in a char string using a my translation routine
but I had a very inefficient compute node.
Is there any better ways to obtain the same output?
Joined: 22 May 2001 Posts: 1072 Location: Fort Worth, TX, USA
You could use the following ESQL in a compute node:
DECLARE C INTEGER;
SET C = CARDINALITY(InputRoot.*[]);
DECLARE I INTEGER;
SET I = 1;
WHILE I < C DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
DECLARE COUNTER INTEGER;
DECLARE J INTEGER;
SET COUNTER = CARDINALITY(InputRoot.XML.A.*[]);
SET J = 1;
SET OutputRoot.XML.A.W = '';
WHILE J <= COUNTER DO
SET OutputRoot.XML.A.W = OutputRoot.XML.A.W || InputRoot.XML.A.*[J];
SET J = J + 1;
END WHILE;
OK, I tested your solution that works fine for XML but I have a some tradeoff for MRM structures.
I choose the BITSTREAM instruction for parsing the MRM tree and padding the MRM fields with the missing blanks in respect of the CWF lengths.
If I use the concatenation of the fields I have the field's serialization but without these blanks.
Do you agree with my experiments?
When are used the physical MRM definitions?
When is built the physical string?
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