Custom Moddle: treat any inner content as it's value even if it is an xml-like snippet


Hi, I a making a type in my custom moddle like this:

"prefix": "fedd",
"types": [
        "name": "View",
        "properties": [
                "name": "type",
                "isAttr": true,
                "type": "String",
                "xml": {
                    "serialize": "xsi:type"
                "name": "content",
                "type": "String",
                "isBody": true

but unfortunately this xml lacks anything when the moddle is read:

    <fedd:view type="main">
            <div class="row">
              <div class="cell" id="i9943v">
                <div id="imd681">Test Page</div>

It serializes back as just

    <fedd:view type="main"/>

How do I tell my moddle to treat as content anything it meets inside the element, even if it looks like some xml tags?


That’s how XML works. Some characters have special meanings in XML therefore you must escape these characters if you don’t want them to be interpreted as XML.

Your HTML should look like this:

&lt;div class=&quot;row&quot;&gt;
  &lt;div class=&quot;cell&quot; id=&quot;i9943v&quot;&gt;
    &lt;div id=&quot;imd681&quot;&gt;Test Page&lt;/div&gt;

bpmn-js actually escapes special caracters when exporting a diagram as XML.