Re: RFE: Invalid IDREF cause 'Copy as Reference' to silently fail
Hussein Shafie <[email protected]> Wed, 1 Mar 2023 10:06:22 +0100
| Newsgroups | gmane.editors.xxe.general |
|---|---|
| Message-ID | <[email protected]> |
The problem you report is a real one, but we don't completely agree with your analysis: * <div id='What?'>Foo</div> id='What?' is just fine in an XHTML5 document, no matter whether XXE supports XInclude or not. * Yes, 'Copy as Reference' should report an error message when it fails to create a reference out of the selection. This bug is fixed now and 'Copy as Reference' will report an error message in this case. However the error message will not give you much details about what went wrong. * With <div>Foo</div> (no id attribute) selected 'Copy as Reference' works fine if (1) this div is the root element of the document and/or (2) option "Allow advanced use of XInclude" is turned on. See http://www.xmlmind.com/xmleditor/_distrib/doc/help/editOptions.html Otherwise 'Copy as Reference' is disabled (grayed menu entry "Edit → Reference → Copy as Reference"). Now, we'll have to investigate to see if we can (or is legit to) make 'Copy as Reference' work even with an ID like 'What?'. On 2/28/23 23:23, Leif H Silli wrote: > For XHTML5, the XML-based validity constraints on id attributes (that > is, on IDREFs), have been lifted. And so, since XHTML5 lacks those > constraints, XXE does not prevent us from adding the following element > to an XHTML5 document: > > <div id='What?' >Foo</div> > > Explanation: Questionmarks are amongst the “special characters” that are > not permitted inside id attributes of XHTML1.x documents – and thus such > characters would also not occur in id attributes, as long as you were > using a validating editor such as XXE. Hence, in the good old days > before XHTML5 was introduced, the issue I am taking up in this message, > would basically never occur. > > However, provided the XXE user makes use of XInclude inclusions, the > validity constraints of XHTML1.x are as relevant as ever before. > > And so, given the above fragment, if, using XXE, you select it, and then > select the command 'Copy as Reference' (from the bottom submenu of the > Edit menu), nothing happens. You do not get a warning telling you that > 'Copy as Reference' failed because the id attribute contained characters > which, from the XInclude point of view, are forbidden. The only way to > understand that it did not work, is when you paste the reference - > without getting any result. > > So basically, in the above example, currently we get the same feedback > as if we tried to apply 'Copy as Reference' to the following element > (which lacks an id attribute): > > <div>Foo</div> > > That is: We do not get any feedback. > > Proposal for a fix: > > EITHER, let XXE display a 'failure' message based on a validity > conformance check of the IDREF, every time 'Copy as Reference' is used > without success. (This requires the presence of an id attribute.) > > OR, let XXE simply display a general warning, every time 'Copy as > Reference' does not yield any result - even when the reason for the > “failure” is that the element lacks an id attribute. > > That is, in the case of the 'OR' option, if the user tries to apply > 'Copy as Reference' to an element which lacks the id attribute, display > the general warning. And also, display the same general warning if the > content of the id attribute fails to yield any result. > > Example text of general warning: “No reference was copied, either > because there was no id attribute, or (if there was an id attribute) > because the content of the id attribute of the selected element [or, if > running with the 'advanced' XInclude option, of nearest parent element] > did not meet the validity constraints required by XInclude.” > > I believe at least the 'OR' option should work also when XXE is running > with 'advanced XInclude' support enabled. In my case, I was running XXE > with the 'advanced' XInclude support active, when I failed to get a > result when copying the child element of a fragment. At first I thought > the issue was specific to the advanced XInclude support, but then I came > to understand that the issue is so fundamental that it is also present > in XXE's default XInclude support mode. > > Leif Halvard Silli > -- XMLmind XML Editor Support List [email protected] http://www.xmlmind.com/mailman/listinfo/xmleditor-support