I have two different parent node Example inside the parent node volume tag is the behaviour in one parent node have block element other one have inline element how can i handle it, i got an SyntaxError: Mixing inline and block content @marijn
<box>
<volume>10</volume>
<p>text normal inline</p>
</box>
<sectionbox>
<volume>10</volume>
<lable>text normal block</label>
</sectionbox>```
A given node type must have either inline children or block children. As the error shows, the library doesn’t allow you to mix them. As such, you’re probably going to have to define different types of parent nodes for these different cases.
I’m developing an editor for XML data which follows a different kind of DTD. Because creating numerous wrappers is not possible, I’m considering a single generic container tag that accepts all block-level elements as well as nested containers, allowing for recursive nesting.
My plan is to implement a dynamic, recursive check based on a basic schema (including paragraphs, lists, figures, and various inline nodes) so that when mixed content is encountered, the editor can split the content and wrap it within this container tag.
Additionally, since attributes may vary for any tag, I’m thinking of converting them into a JSON string and storing that data in a common attribute (e.g., data-meta-attr). The editor would then parse this JSON to update or render the attribute information.
Is this approach feasible, or do you have any suggestions for improvements or alternatives for handling such dynamic XML content and attribute management? @marijn