|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
Esql help on string to xml |
« View previous topic :: View next topic » |
Author |
Message
|
jefflowrey |
Posted: Wed Dec 20, 2006 2:02 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can't use XMLNSC in v5, true.
But you can and should use XMLNS. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Bravo |
Posted: Wed Dec 20, 2006 2:25 pm Post subject: |
|
|
Centurion
Joined: 03 Oct 2005 Posts: 146
|
Jeff,
I try executing the code with Domain as XMLNS
Code: |
CREATE LASTCHILD OF Environment DOMAIN('XMLNS') PARSE(InputLocalEnvironment.ResultSet[1].GENRC_DATA_CHAR, InputProperties.Encoding,InputProperties.CodedCharSetId);
DECLARE I INTEGER 2;
DECLARE J INTEGER CARDINALITY(InputLocalEnvironment.ResultSet[]);
WHILE I <= J DO
CREATE NEXTSIBLING OF Environment.XMLNS.INVOICEMSG PARSE(InputLocalEnvironment.ResultSet[I].GENRC_DATA_CHAR, InputProperties.Encoding,InputProperties.CodedCharSetId);
SET I = I + 1;
END WHILE; |
The o/p came as
Environment.XMLNS.INVOICEMSG[1];
Environment.XMLNS.INVOICEMSG[2].XMLNS.INVOICEMSG;
Environment.XMLNS.INVOICEMSG[3].XMLNS.INVOICEMSG;
I tried with this code with Domain as XMLNS
Code: |
DECLARE rResultSet REFERENCE TO InputLocalEnvironment.ResultSet;
DECLARE bFirstResultSet BOOLEAN true;
-- Create a reference to use later
DECLARE rEnv REFERENCE TO InputRoot;
WHILE LASTMOVE(rResultSet) DO
IF (bFirstResultSet) THEN
CREATE LASTCHILD OF Environment AS rEnv DOMAIN 'XMLNS' NAME 'XML';
SET bFirstResultSet = false;
ELSE
CREATE NEXTSIBLING OF rEnv AS rEnv REPEAT;
END IF;
CREATE LASTCHILD OF rEnv PARSE(rResultSet.GENRC_DATA_CHAR, InputProperties.Encoding,InputProperties.CodedCharSetId);
MOVE rResultSet NEXTSIBLING NAME 'ResultSet';
END WHILE; |
The o/p came as
Environment.XML[1].XMLNS.INVOICEMSG;
Environment.XML[2].XMLNS.INVOICEMSG;
Environment.XML[3].XMLNS.INVOICEMSG;
No luck _________________ Bravo |
|
Back to top |
|
 |
kimbert |
Posted: Wed Dec 20, 2006 4:02 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
Hi Bravo,
- Jeff and I did not expect the XMLNS domain to solve all your problems. It's simply bad practice to use XML domain in new flows.
- I recommend using FolderBitstream mode when parsing the INVOICEMSG. That will get rid of the extra 'XMLNS' level in the message tree.
- You have changed your requirement. Your previous post included a repeating field with name 'Data'. Now it looks as if you want to get
Code: |
Environment
XMLNS
INVOICEMSG[1]
INVOICEMSG[2]
INVOICEMSG[3]
|
So I think you need a much simpler loop which executes a line of code something like this:
Code: |
CREATE LASTCHILD OF Environment.XMLNS PARSE (...) OPTONS FolderBitStream |
|
|
Back to top |
|
 |
|
|
|
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
|
|
|
|