CDATA
What causes the ![CDATA[ in a string field?
<QueryParameters><![CDATA[showportalonly=1&leaveunprocessed=0&limit=5000]]></QueryParameters>
Comments
Where do you see the .png)
.png)
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.
in XML the construct with ![CDATA[ gets used if the string contains any
character that may cause conflicts in XML parsing:
In your case it is the & (Ampersand) that triggers the different use.
THIS causes the ![CDATA[ in a string field!
.
THIS causes the ![CDATA[ in a string field!
This causes the CDATA in the visualization of a string field in the Management Portal.
The string field does not contain any CDATA (unless assigned in the string property content).
Thanks Robert