Creates a localizable message (see Localization Support) from free-form XML content.
The message created will be the literal XML content within the XmlMessage element, with one exception: The content of any replace element will be set to the expression it contains.
The replace element as a simple token replacement mechanism; if you require more complex token formatting, or the ability to change message text without changing rules, consider using ResourceMessage instead.
If you require the pre-Cúram V6 trimming behavior of XmlMessage, then you must set the application environment variable curam.creole.XmlFormat.enableWhitespaceTrimming to the value true in your development environment.
In a production environment, you should ensure that if the value of the curam.creole.XmlFormat.enableWhitespaceTrimming environment variable is changed dynamically, you take steps to ensure that any derived data in your system that depends on rule attributes which use the XmlMessage expression must be forced to recalculate all stored attribute value instances.
<?xml version="1.0" encoding="UTF-8"?> <RuleSet name="Example_XmlMessage" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "http://www.curamsoftware.com/CreoleRulesSchema.xsd"> <Class name="XmlMessageExampleRuleClass"> <Attribute name="emptyMessage"> <type> <javaclass name="curam.creole.value.Message"/> </type> <derivation> <!-- contains no XML at all --> <XmlMessage/> </derivation> </Attribute> <Attribute name="simpleHtmlMessage"> <type> <javaclass name="curam.creole.value.Message"/> </type> <derivation> <!-- Using XmlMessage can ensure that XML elements are started and ended correctly, e.g. <b> and </b> --> <XmlMessage>The following text will appear in bold in a browser: <b>Some in bold text.</b> </XmlMessage> </derivation> </Attribute> <Attribute name="tokenReplacementHtmlMessage"> <type> <javaclass name="curam.creole.value.Message"/> </type> <derivation> <XmlMessage><p/>This calculated number will appear in italics and formatted according to locale preferences:<i> <replace> <arithmetic operation="+"> <Number value="1.23"/> <Number value="3.45"/> </arithmetic> </replace> </i> <p/>And here's a resource message: <replace> <ResourceMessage key="simpleGreeting" resourceBundle="curam.creole.example.Messages"/> </replace> </XmlMessage> </derivation> </Attribute> </Class> </RuleSet>