Fix entity handling in the main document content (attributes still broken)
authorlars <lars@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jul 2007 13:57:54 +0000 (13:57 +0000)
committerlars <lars@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jul 2007 13:57:54 +0000 (13:57 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24731 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/dom/XMLTokenizer.cpp

index 292ee941b53292e7b4eab1f322b91680015d8ea9..ef047cfcf39a933154530c68611528359e70cfcb 100644 (file)
@@ -1,3 +1,12 @@
+2007-07-27  Zack Rusin  <zack@kde.org>
+
+        Reviewed by Zack and Lars.
+
+        Fix entity handling in the main document content (attributes still broken)
+
+        * dom/XMLTokenizer.cpp:
+        (WebCore::):
+
 2007-07-27  Lars Knoll  <lars@trolltech.com>
 
         Reviewed by Zack and Lars.
 2007-07-27  Lars Knoll  <lars@trolltech.com>
 
         Reviewed by Zack and Lars.
index 762dafe726f35bd4ed1bfa45d7a752a2d74fa042..381c8f7aa5d511a71b4cb47ac1ee4608d1b825fc 100644 (file)
@@ -1635,7 +1635,6 @@ void XMLTokenizer::parse()
 {
     while (!m_parserStopped && !m_parserPaused && !m_stream.atEnd()) {
         m_stream.readNext();
 {
     while (!m_parserStopped && !m_parserPaused && !m_stream.atEnd()) {
         m_stream.readNext();
-            qDebug() << m_stream.tokenType() << m_stream.text().toString();
         switch (m_stream.tokenType()) {
         case QXmlStreamReader::StartDocument: {
             startDocument();
         switch (m_stream.tokenType()) {
         case QXmlStreamReader::StartDocument: {
             startDocument();
@@ -1673,7 +1672,18 @@ void XMLTokenizer::parse()
         }
             break;
         case QXmlStreamReader::EntityReference: {
         }
             break;
         case QXmlStreamReader::EntityReference: {
-            //qDebug()<<"---------------- Entity";
+            //qDebug()<<"---------- ENTITY = "<<m_stream.name().toString()
+            //        <<", t = "<<m_stream.text().toString();
+            if (isXHTMLDocument()) {
+                QString entity = m_stream.name().toString();
+                UChar c = decodeNamedEntity(entity.toUtf8().constData());
+                if (m_currentNode->isTextNode() || enterText()) {
+                    ExceptionCode ec = 0;
+                    String str(&c, 1);
+                    //qDebug()<<" ------- adding entity "<<str;
+                    static_cast<Text*>(m_currentNode)->appendData(str, ec);
+                }
+            }
         }
             break;
         case QXmlStreamReader::ProcessingInstruction: {
         }
             break;
         case QXmlStreamReader::ProcessingInstruction: {