Buggy XML parsing in HEAD

Peter Kelly pmk at kde.org
Mon Feb 17 23:58:39 GMT 2003


What exactly is breaking here? I've tried both examples (in konqueror and 
also with the sample code you provided) and they both work as expected. 
That is, all text is displayed on the one line with no formatting (the 
elements are not interpreted as html elements).

On Sun, 16 Feb 2003, Richard Moore wrote:

> I've been working on adding support for XPath to HEAD, however it seems
> the basics of XML parsing are still somewhat fragile:
> 
> KHTML breaks with this:
> 
> <?xml version="1.0" ?> 
> <table>
> <tr>
> <th>One</th> 
> <th>Two</th> 
> <th>3</th> 
> <th>44444</th> 
> </tr>
> </table>
> 
> But this is ok:
> 
> <?xml version="1.0" ?> 
> <mytable>
> <tr>
> <th>One</th> 
> <th>Two</th> 
> <th>3</th> 
> <th>44444</th> 
> </tr>
> </mytable>
> 
> It seems khtml is too eager to switch to HTML mode. I am running
> HEAD of a few days ago, and invoking khtml like this:
> 
>     KHTMLPart *html = new KHTMLPart;
>     KParts::URLArgs uargs( html->browserExtension()->urlArgs() );
>     uargs.serviceType = "text/xml";
>     html->browserExtension()->setURLArgs( uargs );
> 
>     QString doc;
>     if ( args->count() ) {
> 	QString fn = args->arg(0);
> 	QFile file( fn );
> 	if ( !file.open( IO_ReadOnly ) )
> 	    return false;
> 
> 	QTextStream ts( &file );
> 	doc = ts.read();
>     }
>     else {
> 	doc = QString("<test><item></item></test>");
>     }
> 
>     html->begin();
>     html->write( doc );
>     html->end();
> 
> Does anyone have any ideas?
> 
> Cheers
> 
> Rich.
> 

-- 
Peter Kelly
pmk at kde.org





More information about the kfm-devel mailing list