Moddle won't parse an attribute with same name as the child element

In situations where i have the an attribute name which is same as the child element moddle just won’t parse the structure no matter what;

<custom:formProperty id="formProperty01" name="propName" value="trigger01" type="enum">
    <custom:value id="targetModule" name="SMTP"></custom:value>
    <custom:value id="targetClass" name="Message"></custom:value>
</custom:formProperty>

I was suspicious maybe “value” is a reserved name/localname for the moddle itself but when i try it like this;

<custom:formProperty id="formProperty01" name="propName" experiment="trigger01" type="enum">
    <custom:experiment id="targetModule" name="SMTP"></custom:experiment>
    <custom:experiment id="targetClass" name="Message"></custom:experiment>
</custom:formProperty>

still no luck. I tried everything yet no luck. Only interesting thing i encountered is if i define the type as “String” and ignoring the child elements(no isMany etc definition) it still parses the child Element’s content as String. However if i give an invalid type instead of String it will parse the attribute itself. Can anyone help me with this?

Not entirely sure why it doesn’t work for you. Probably an issue with your model extension.

Here’s a working example: https://codesandbox.io/s/bpmn-js-moddle-extension-example-yldwc

Phillip thank you so much for your help and the codesandbox demo.

I studied your codesandbox link. The problem i am facing is when i try to parse the xml and read the moddle, it won’t parse the custom:value node as in the screenshot of the codesandbox. It however is able to create it as it seems. How can i make it parse the custom:value values is what i wanted to ask.
image

I checked again and you’re right. You cannot have a property that is an attribute and a property with a type that is the same as the other property’s name.

This is an issue with the moddle-xml library.

I created a GitHub issue that addresses this limitation: https://github.com/bpmn-io/moddle-xml/issues/43

Thanks for letting us know.

1 Like