Message Format - ExtensionML

ExtensionML is a special form of markup that a front end app can use to perform custom rendering of an entity, instead of relying on Symphony to perform the default presentation.

ExtensionML is generated from a given entity and emitted by a built-in or third-party renderer. It is similar to PresentationML but is used for interactive presentation.

While similar to PresentationML, ExtensionML consists of a template and corresponding data. Each tag in the template can have an ID that references a value stored in the data, binding the data to whatever is being rendered. For example, multiple paragraphs in the template can reference a sentence stored in the data by ID, allowing for reuse of that sentence in multiple places within the template being rendered.

Symphony Elements

Note: ExtensionML does not support Symphony Elements. For more information, refer to Symphony Elements.

Standard HTML Tags

A number of standard HTML tags are supported within templates: b, u, i, strong, br, ul, ol, li, span, div, table, th, tr, and td.

These behave like their HTML counterparts but must be properly-formatted XML. So, for example, rather than <br> you must use <br/>.

Text Tags

The following tags present text in different ways. Most of these require data to specify their content, but some can also use the content between the opening and closing tags.

Extended HTML Tags

The following HTML tags are handled in a slightly modified way:

Special Entity Tags

Flow Control Tags

The following flow control tags are used for entities that have conditional logic or data that can be iterated upon:

The following example shows the XML template for an entity with flow control logic and corresponding data:

<entity>
    <label>Guild: </label><text id="guildName"/>
    <if id="webpageLink">
        <label>Web page: </label>
        <a id="webpageLink"><text id="webpageName"/></a>
    </if>
    <if id="people">
        <iterate id="people">
            <label>Name: </label><text id="name">
            <label>Notes:</label><br/>
            <formatted id="notes"/>
            <if:not-last><hr/></if:not-last>
        </iterate>
    </if>
</entity>
var data = {
    "content" = {
        "guildName": "Loyal Order of Water Buffalo",
        "webpageLink": "https://www.waterbuffalo.net/bedrock",
        "webpageName": "The Loyal Order of Water Buffalo, Bedrock Chapter",
        "people": [{
            "name": "Fred Flintstone",
            "notes": "Yabba Dabba Dooooo!"
        },
        {
            "name": "Barney Rubble",
            "notes": "Fred's sidekick"
        },
        {
            "name": "Dino",
            "notes": "He's kind of like a dog, but also a small sauropod. Yaps a lot.<br/> Really odd, he spoke in his first appearance."
        }]
    }
}

Generating Properly Formatted XML

The following function can be used to turn HTML into properly formatted XML:

function xmlize(html) {
    return new XMLSerializer().serializeToString($('<span>').html(html)[0])
}

Last updated