Author |
Message
|
goldym |
Posted: Tue Oct 18, 2005 9:49 am Post subject: Preserving XML Tags |
|
|
Centurion
Joined: 24 Jun 2005 Posts: 116
|
MQInput Node-->Compute Node (Calls Java program to uncomress file. It also saves the Uncompressed data in an Environment variable) -->RCD (Reset to XML)-->MQOutput node
I have a message flow that calls a java program that Uncompresses an xml message. I had to output the Uncompressed message from Blob to string and put the output in the environment.
I then used a RCD node to Reset to XML and then retrieve the data from the environment.variable in the next node. However two things go wrong.
1. It adds an extra root element.
2. The parser converts my <data> tags to the </data> (escaped characters)
Does anyone know how i would remove the extra root tag and preserve the XML tags. I guess I need to wrap the data in some kind of CDATA block. Not sure how to do that.
any ideas? |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Oct 18, 2005 9:53 am Post subject: Re: Preserving XML Tags |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
goldym wrote: |
I had to output the Uncompressed message from Blob to string and put the output in the environment. |
Why?
goldym wrote: |
1. It adds an extra root element. |
Why? Your code does this, not the parser.
goldym wrote: |
2. The parser converts my <data> tags to the </data> (escaped characters) |
Well, because it doesn't think it's XML.
The typical way to take a string of XML data that has been retrieved from some source and turn it into a logical message tree is to use CREATE FIELD with the PARSE and DOMAIN options. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
goldym |
Posted: Tue Oct 18, 2005 10:24 am Post subject: |
|
|
Centurion
Joined: 24 Jun 2005 Posts: 116
|
Hi Jeff,
Yes my code does add the extra field b/c I didn't know how to put it in a queue without setting it like that. Where do I need to do the CREATE FIELD when I am trying to access my environment.variables ?
Uncompress Node:
DECLARE OUTCHAR CHARACTER;
DECLARE IRROOT REFERENCE TO InputRoot.BLOB;
DECLARE P1 BLOB;
-- CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
-- call java
SET P1 = IRROOT.BLOB;
CALL DoUncompress(P1) INTO OUTCHAR;
IF P1 = NULL THEN
RETURN FALSE;
END IF;
CALL CopyMessageHeaders();
SET Environment.XML.UNCOMPRESSED = OUTCHAR;
-- change COMPRESS FLAG
SET OutputRoot.MQRFH2.usr.COMPRESSED = 'FALSE';
RETURN TRUE;
END;
Reset to XML:
Next Node:
SET OutputRoot.XML.Dummy = Environment.XML.UNCOMPRESSED; |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Oct 18, 2005 10:26 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
goldym wrote: |
Next Node:
SET OutputRoot.XML= CREATE FIELD ..... PARSE ....Environment.XML.UNCOMPRESSED; |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
goldym |
Posted: Tue Oct 18, 2005 1:30 pm Post subject: |
|
|
Centurion
Joined: 24 Jun 2005 Posts: 116
|
[quote="jefflowrey"][quote="goldym"]Next Node:
SET OutputRoot.XML= CREATE FIELD ..... PARSE ....Environment.XML.UNCOMPRESSED;[/quote][/quote]
Thanks Again Jeff,
I can not figure out this syntax because the help said not to use a PArse clause with the field qualifier. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Oct 19, 2005 3:28 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Sorry.
Leave out FIELD. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
goldym |
Posted: Wed Oct 19, 2005 4:33 am Post subject: |
|
|
Centurion
Joined: 24 Jun 2005 Posts: 116
|
--PARSE--(--BitStreamExpression--+------------------------------+--)--|
My data is in an Environment.Variable do i need to Set this to a bit stream? In order to use the Create Parse clause? |
|
Back to top |
|
 |
|