XML rendering [IRC Channel]

Zack Rusin zack at kde.org
Sat Jun 5 17:19:52 CEST 2004


On Saturday 05 June 2004 09:18, Leo Savernik wrote:
> Though, the attached testcase still doesn't work in khtml (throws
> some "null object" error. Is getElementsByTagName not impl'd for
> xml?). Compare to Mozilla to check what the testcase should do.

Oh, cool, good one :)

I need to merge some of my local changes, but one of the worst problems 
right now is the lack of style detection in the xhtml documents for xml 
elements. Check the enclosed testcase.

I can easily fix the elements with inlined style by just adding the 
following patch to the xml tokenizer:

--- xml/xml_tokenizer.cpp       2 Jun 2004 17:47:52 -0000       1.52
+++ xml/xml_tokenizer.cpp       5 Jun 2004 15:14:45 -0000
@@ -29,6 +29,7 @@
 #include "rendering/render_object.h"
 #include "misc/htmltags.h"
 #include "misc/htmlattrs.h"
+#include "misc/htmlhashes.h"
 #include "misc/loader.h"

 #include "khtmlview.h"
@@ -149,7 +150,17 @@ bool XMLHandler::startElement( const QSt
         DOMString uri(atts.uri(i));
         DOMString qn(atts.qName(i));
         DOMString val(atts.value(i));
-        newElement->setAttributeNS(uri, qn, val, exceptioncode);
+
+        if ( newElement->isHTMLElement() ) {
+            int exceptioncode = 0;
+            QCString str = qn.string().utf8();
+            unsigned int a = getAttrID( str, str.length() );
+            newElement->setAttribute( a, val, qn, exceptioncode );
+        } else {
+            newElement->setAttributeNS( uri, qn, val, exceptioncode );
+        }
+
         if (exceptioncode) // exception setting attributes
             return false;
     }

But this is not optimal and still leaves the problem of the predefined 
style for div id="data" element. Any ideas?

And btw, let me remind everyone that we do have a very low traffic 
#khtml irc channel on freenode with essentially only the few kde 
developers you see on this list. We'd love to see some Apple and 
Omnigroup developers there (ties and shirts not required, but about 21" 
in bicep strongly recommended ;) ).

Zack

-- 
The reason we nerds dominate is . . . Oh, wait, Is that beer? 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: demo2.xml
Type: text/xml
Size: 261 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/khtml-devel/attachments/20040605/750f6ccb/demo2.xml


More information about the Khtml-devel mailing list