Question
· Jun 17

CDATA

What causes the ![CDATA[ in a string field?

<QueryParameters><![CDATA[showportalonly=1&leaveunprocessed=0&limit=5000]]></QueryParameters>

Product version: IRIS 2021.1
Discussion (6)2
Log in or sign up to continue

Where do you see the ![CDATA[  ?

CDATA it's part of an XML document, "a CDATA section is a piece of element content that is marked up to be interpreted literally, as textual data, not as marked-up content" (from wikipedia).

If it's contained in a string property (is this that you mean by field?), then evidently that value was assigned to the string value.

But I suspect your question is missing the context......

Sorry but, again, you are missing important context and details.
With some imagination, fantasy and creativity I can guess the missing info....

What class does your AthenaChangeDataSubscription class exstends?
I guess Ens.Request or %Persistent and %XML.Adaptor and possibly others, this is crucial info.

Where do you see the ![CDATA[ ? (I asked, you did not answer)
I guess from the picture you post you see it in the Contents viewer in Visual Trace, again, this is crucial info.

Now, to your original question:
What causes the ![CDATA[ in a string field?

The CDATA is not in your string property, it is only in the visualization in the portal of the content of your class/property.

Here is a sample request that, I imagine, is similar to your class:

Class Community.msg.AthenaChangeDataSubscription Extends Ens.Request
{
Property QueryParameters As %String;
}

Here is what the IRIS Interoperability portal is using to display the content:

EPTEST>Set msg=##class(Community.msg.AthenaChangeDataSubscription).%New()
 
EPTEST>Set msg.QueryParameters="showportalonly=1&leaveunprocessed=0&limit=5000"
 
EPTEST>Set sc=##class(EnsPortal.MessageContents).writewithoutNonXMLChars(,msg)
<AthenaChangeDataSubscription xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><QueryParameters><![CDATA[showportalonly=1&leaveunprocessed=0&limit=5000]]></QueryParameters></AthenaChangeDataSubscription>
EPTEST>w msg.QueryParameters
showportalonly=1&leaveunprocessed=0&limit=5000
EPTEST>

As you can see the ACTUAL CONTENT of your QueryParameters property does not have any CDATA, the XML VISUALIZATION of your property content does have CDATA, and that's because it is required by XML to properly display the real/actual content.
The IRIS interoperability portal display the XML representation of your class and does it in the proper/correct XML representation.

If your property contains simple text that can be properly (correctly) "rendered" in XML without CDATA, then:

EPTEST>Set msg=##class(Community.msg.AthenaChangeDataSubscription).%New()
 
EPTEST>Set msg.QueryParameters="this is a simple content"
 
EPTEST>Set sc=##class(EnsPortal.MessageContents).writewithoutNonXMLChars(,msg)
<AthenaChangeDataSubscription xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><QueryParameters>this is a simple content</QueryParameters></AthenaChangeDataSubscription>

As you can see there is no CDATA.

Please, please, in the future, provide details of the context.
Imagination, fantasy and creativity should not be a requirement to understand a question.