Re: RFE: Invalid IDREF cause 'Copy as Reference' to silently fail

Leif H Silli <[email protected]> Thu, 02 Mar 2023 16:55:42 +0100
Newsgroups gmane.editors.xxe.general
Organization Lenk.no/Silli
Message-ID <[email protected]>
So, put simply, in case of id="1_invalid_NCName", the fix is to ignore 
the ID (that is: to treat the element as one without a ID).

This is an improvement. I am satisified. But I would of course like to 
make some points:

Side effect 1: This should dramatically reduce the need for error 
message(s) for the situation(s) when «Copy As Reference» would fail. 
Actually, I struggle to come up with situations where error messages 
would be warranted…

Side effect 2: If the user runs XXE with Advanced XInclude enabled *and* 
also the (recommended!) option to warn against use of Advanced XInclude 
enabled, then, when using Copy as Reference and if the targeted ID does 
not meet the NCName requirementes, the user would get a warning against 
use of Advanced XInclude. And so the user would *anyhow* wonder why XXE 
“failed” to use the ID as shorthand XPointer.

Side effect 3: Occassionally, when advanced XInclude is disabled, some 
will wonder why "Copy as Reference" is grayed out for 
id="1_invalid_NCName".

Error message: Even if an error message for "Copy as Reference" would 
seldom, if ever, bee warranted, what more would an error message need to 
do, other than pointing out that the ID did not meet the NCName 
requirement, and perhaps link to a good Web page which explains the 
ideosyncratic rules for NCNames? (For example, the issue that Ethiopian 
letters being forbidded and so on, see 
https://www.oreilly.com/library/view/xml-in-a/0596007647/re148.html )

Leif Halvard Silli

2023-03-02 10:20 Hussein Shafie:
> We now consider this bug to be fixed.
> 
> * When the "Copy As Reference" menu item is not disabled (grayed) and
> this command fails to create a reference, it now displays an error
> dialog box. The error message does not explain why the command has
> failed. Anyway this explanation would be quite technical and hard to
> understand for the average user.
> 
> * With option "Allow advanced use of XInclude" turned OFF and an
> XHTML5 element having id="What?", the "Copy As Reference" menu item is
> now disabled (grayed). id="What?" is a valid XHTML5 ID but cannot be
> used to create an shorthand XPointer. A shorthand XPointer (AKA
> barename) must be an NCName.
> 
> * With option "Allow advanced use of XInclude" turned ON and an XHTML5
> element having id="What?", the "Copy As Reference" menu item works and
> creates an Element scheme XPointer looking like element(/1/2/2/3) or
> element(valid_ancestor_id/2/4/1), valid_ancestor_id being an NCName.


--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support