[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: Bug in Qt
From: Thomas <zander () xs4all ! nl>
Date: 2000-12-06 14:21:19
[Download RAW message or body]
> Hi,
>
> for the SGML import filter I'm writing I was trying to import text that
> contains special characters like '<', '>' and '&'. The Qt DOM classes
> seem to do the conversion to "<", ">", and "&" by themselves.
> The function that acually does the work is encodeAttr () which is in
> qt/src/xml/qdom.cpp:
>
> static QString encodeAttr( const QString& str )
> {
> QString tmp( str );
> uint len = tmp.length();
> uint i = 0;
> while ( i < len ) {
> if ( tmp[(int)i] == '<' ) {
> tmp.replace( i, 1, "<" );
> len += 3;
> i += 4;
> } else if ( tmp[(int)i] == '"' ) {
> tmp.replace( i, 1, """ );
> len += 5;
> i += 6;
> } else if ( tmp[(int)i] == '&' ) {
> tmp.replace( i, 1, "&" );
> len += 4;
> i += 5;
> } else {
> ++i;
> }
> }
>
> return tmp;
> }
>
> There is no case for '>' though. Who do I have to talk to to get this
> fixed? I'm using the Qt library that was part of KDE 2.0. The sad thing
> is that there is not even a workaround for my problem so I will have to
> deactivate '>' for now because otherwise they will create havoc in the
> XML code.
XML spec;
The ampersand character (&) and the left angle bracket (<) may appear in their \
literal form only when used as markup delimiters, or within a comment, a processing \
instruction, or a CDATA section. They are also legal within the literal entity value \
of an internal entity declaration; see "4.3.2 Well-Formed Parsed Entities". If they \
are needed elsewhere, they must be escaped using either numeric character references \
or the strings "&" and "<" respectively. The right angle bracket (>) may be \
represented using the string ">", and must, for compatibility, be escaped using \
">" or a character reference when it appears in the string "]]>" in content, when \
that string is not marking the end of a CDATA section.
In other words, for XML it is not needed to escape it, but to stay compatible with \
SGML it must be written as >
I suggest you send QT the bug report.
--
Thomas Zander zander@earthling.net
The only thing worse than failure is the fear of trying something new
_______________________________________________
Koffice-devel mailing list
Koffice-devel@master.kde.org
http://master.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic