Author |
Message
|
Raj kumar |
Posted: Fri Dec 05, 2008 6:07 am Post subject: Problems in accessing Environment variables |
|
|
 Novice
Joined: 27 Jun 2008 Posts: 14 Location: India
|
Hi All,
I get a xml message as a string under an element which contains attributes/elements etc..., To convert this string to a xml, I am using the below code to convert and assign it to environment variable.
DECLARE Msg BLOB ASBITSTREAM (InputRoot.XMLNSC CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding) ;
CREATE LASTCHILD OF LocalEnvironment.Destination.Tmp DOMAIN('XMLNSC')
PARSE (Msg
ENCODING InputRoot.Properties.Encoding
CCSID InputRoot.Properties.CodedCharSetId
FORMAT 'XMLNS_OPAQUE' TYPE 'http://www.w3.org/schemas/Test.xsd');
While trying to create an OutputRoot, I have mapped the environment values to Output Body. However these values are not getting mapped/accessible.
Could you please help on this?
Thanks |
|
Back to top |
|
 |
kimbert |
Posted: Fri Dec 05, 2008 8:55 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Looking at your code, several questions spring to mind:
- Why are you using ASBITSTREAM immediately followed by CREATE...PARSE? Why not just copy the elements into the environment tree?
- Why are you using a format name of XMLNS_OPAQUE? Do you know what that means?
- Why are you attempting to use XMLNS_OPAQUE with the XMLNSC domain?
- Why are you putting a filename into the TYPE parameter of your CREATE...PARSE statement?
I think you should explain what you are trying to do - maybe you are solving the wrong problem. |
|
Back to top |
|
 |
Raj kumar |
Posted: Fri Dec 05, 2008 9:42 am Post subject: |
|
|
 Novice
Joined: 27 Jun 2008 Posts: 14 Location: India
|
Looking at your code, several questions spring to mind:
- Why are you using ASBITSTREAM immediately followed by CREATE...PARSE? Why not just copy the elements into the environment tree?
Ans: I have xml escape characters in the string which I recieve from InputRoot.XMLNSC
For other questions - I just took an template code from help.
My requirement is, I need to convert the string data with escape characters in to an xml and access the elements and atrtibutes to create an output from those values.
Could please suggest some better way to do this. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Dec 05, 2008 12:21 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I just took an template code from help |
You should read more carefully
That topic is explaining how to use the 'opaque parsing' feature of the XMLNS parser. And it does not show a filename being used in the TYPE parameter.
Quote: |
I have xml escape characters in the string which I recieve from InputRoot.XMLNSC |
The XMLNSC parser will expand any escaped characters when it parses the message. There must be some detail which you have not told us yet - maybe these characters come from a CDATA section? Or maybe they have been escaped twice before arriving in your message flow?
Quote: |
My requirement is, I need to convert the string data with escape characters in to an xml and access the elements and atrtibutes to create an output from those values. |
It's hard to advise without knowing a few more details. Please insert a Trace node immediately before your Compute node, and set the pattern to '${Root}'. Post the input message and the Trace node output here. If they are large, just post the relevant parts. |
|
Back to top |
|
 |
Raj kumar |
Posted: Fri Dec 05, 2008 12:40 pm Post subject: |
|
|
 Novice
Joined: 27 Jun 2008 Posts: 14 Location: India
|
Yes, they have been escaped twice before arriving in my message flow
Will soon post the trace details..
For now, the trace had looked like
Properties....
MQMD....
XMLNSC
Header
ns = www.example.org/..
Main
element = 'test'
element2 = 'test2'
I am just giving an idea, since I dont have access to run/get the trace at present. Will post it shortly!! |
|
Back to top |
|
 |
|