While XMLText is great, sometimes you want to force a CDATA block. For example, I work with XML where one of the tags can contain Java code, which contains < characters. You either have to escape all of them (ugly, hard to maintain) or enclose it in a CDATA.
Perhaps even allow CDATA to be variable, such as:
@XMLText(
{
// CDATA will be emitted when this expression resolves to true for the given text
cdata: (text) => text.length > 80
}
)
While XMLText is great, sometimes you want to force a CDATA block. For example, I work with XML where one of the tags can contain Java code, which contains
<characters. You either have to escape all of them (ugly, hard to maintain) or enclose it in a CDATA.Perhaps even allow CDATA to be variable, such as: