Mark Fletcher wrote: > > I appreciate that XXE lets me open an invalid template and then insert a > child to make it valid. And the interface does make it clear that there > is something wrong with the dita element. My problem is that: a) > inserting the first child--which should make the empty dita element > valid--doesn't try to enforce validity on that first child; b) lenient > mode evidently doesn't display elementTemplates in the picklist. > > Again, when I insert a second child into to the dita tags, that child is > inserted with the required first child (title) and with the id attribute > highlighted as required. Why doesn't this happen when I insert the first > child?
XXE is semi-dumb in lenient mode. > I tried to get around the problem by creating valid > elementTemplates for each of those children (using > selectable="override"), thinking that these would be what the user would > be allowed to choose from and insert. But the elementTemplates aren't > available in the pick list until lenient mode is off, I guess? * Document templates (and element templates) must always be structurally valid (no red icon). See http://www.xmlmind.com/xmleditor/_distrib/doc/configure/dtd_example.html Here's the document template called "Multiple Topics" which is found in the future DITA configuration. --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE dita PUBLIC "-//OASIS//DTD DITA Composite//EN" "../dtd/ditabase.dtd"> [***] <dita> <topic id="???"> <title></title> <body> <p></p> </body> </topic> </dita> --- If the user does not want the <dita> root element to contain a <topic>, well, she/he simply needs to use Edit|Replace to replace it by a <task>, <reference>, etc. It is also possible to add more document templates having the <dita> element as their root. * Unlike many other XML editor, XXE is designed to be used in strict, validating, mode 99,99% of the time. Using lenient mode should be exceptional. --- [***] To my knowlegde, there is no public DITA DTD and Schema repository at OASIS. We would have preferred to write something like: <!DOCTYPE dita PUBLIC "-//OASIS//DTD DITA Composite//EN" "http://www.oasis-open.org/dita/dtd/ditabase.dtd"> But with the bundled XML catalog, there should be no problem. --- PS: The DITA cofiguration contains this new V3.2 feature: --- <!-- This is needed because in DITA, many elements may be empty (due to conref?) and this is often very surprising (e.g. strow). Without this facility (invented for DITA in fact), it would be necessary to add dozens of elementTemplates to this configuration. --> <newElementContent addChildElements="elementOnlyContentNotEmpty" /> --- With DITA, most elements have an emptiable content (for conref, I guess) which is surprising and unpleasant to use for the author. With the above trick, no need to write hundreds of elementTemplates having a non-empty content.

