Martin Kola??k wrote:
>
> if DTD defines an element, which XXE does not recognize as paragraph
> element, and the element can contain #text, it is impossible to remove this
> #text out. Even if it should be able to done, as DTD allows it. The same
> situation for paragraph elements does not occur -- XXE allows create empty
> paragraph element without any node, including #text too.
I don't understand. With a DTD (but not with a XML-Schema), elements
which can contain text are always treated the same by XXE. What you
describe can only happen with a structurally invalid element.
Example (vaguely XHTML-like):
<!ELEMENT div (#PCDATA|ul|p|pre)*>
In a mixed element, child elements are not mandatory. Therefore by
default, when inserting a div, XXE uses the simplest possible div, a div
with an empty text node (#text in the node path bar, represented
graphically by an ``ink blob'').
This can be customized by specifying an elementTemplate for the div in
XXE configuration file.
<elementTemplate name="MyDiv" selectable="override">
<div xmlns=""><p>Type text here.</p></div>
</elementTemplate>
> I would like, if #text could be removed in both cases -- sometimes #text is
> really optional and now the XXE always puts a placeholder for editing, which
> can be confusing for users. Maybe it would be pretty, if XXE after inserting
> such node creates #text (as default), but this #text would be possible to
> remove.
If the mixed element has at least one child element, you can remove the
text node. You must select the #text explicitly (the red box is around
the ``ink blob'') and use command Delete.
The rationale for not allowing to remove the text node if it would make
the element completely empty is that this would also make the now empty
element *invisible* in the styled view. Which is extremely confusing for
the user, much much more that leaving a harmless placeholder for text.
True, if the mixed element has no child elements, you cannot remove the
text node but you can replace it by a child element.
Example: XXE by default inserts this
<div>#text</div>
Explicitly select the #text (the red box is around the ``ink blob'') and
use command Replace to replace it by ul, p, or pre.
<div><p></p></div>