[Development] [Question] Implementation of XML character validation

Kurt Pattyn pattyn.kurt at gmail.com
Sun Sep 8 20:36:39 CEST 2013


On 08 Sep 2013, at 20:01, development-request at qt-project.org wrote:

> From: Konstantin Ritt <ritt.ks at gmail.com>
> Subject: Re: [Development] [Question] Implementation of XML character validation
> Date: 8 Sep 2013 20:00:45 GMT+02:00
> To: "development at qt-project.org" <development at qt-project.org>
> 
> 
> [2]     Char     ::=     #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]    /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
> in XML 1.0 is quite the same as
> [2] Char	 ::= [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]	/* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
> [2a] RestrictedChar	 ::= [#x1-#x8] | [#xB-#xC] | [#xE-#x1F] | [#x7F-#x84] | [#x86-#x9F]
> in XML 1.1, except of [U+007F..U+0084] and [U+0086..U+009F], which are prohibited now.

Is it prohibited or just "highly discouraged"? Where in XML1.0, characters below 0x0020 were simply not allowed (except for 0x0009, 0x000A and 0x000D), in XML1.1 they are called "highly discouraged" (it seems the constraints have been loosened a bit). How should "highly discouraged" be interpreted: should Qt allow them, or mark them as prohibited?

> 
> The code looks correct for XML 1.0, however I didn't find the surrogates validation code neither in qxml*, neither in QUtfCodec-s. I'll probably write some additional tests once have a time for that.

Correct, I didn't even notice this.

And what about?

bool QXmlUtils::isChar(const QChar c)
{
    return (c.unicode() >= 0x0020 && c.unicode() <= 0xD7FF)
           || c.unicode() == 0x0009
           || c.unicode() == 0x000A
           || c.unicode() == 0x000D
           || (c.unicode() >= 0xE000 && c.unicode() <= 0xFFFD);
}
Isn't this code missing the check 
c >= 0x10000 && c <= QChar::LastValidCodePoint ?


> You may want to raise a suggestion/feature request via http://bugreports.qt-project.org/ about upgrading XML support in Qt up to 1.1
> 
> 
> Regards,
> Konstantin
> 
Regards,

Kurt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130908/89a7932e/attachment.html>


More information about the Development mailing list