Buggy XML parsing in HEAD

Richard Moore rich at xmelegance.org
Sun Feb 16 23:52:29 GMT 2003


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.




More information about the kfm-devel mailing list