[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: How to enable stylesheet loading in KHTMLPart?
From:       Ellis Whitehead <kde () ellisw ! net>
Date:       2001-09-30 3:28:52
[Download RAW message or body]

Correction to what I just wrote:
The code below does try to load the css file, but its behavior is different 
depending upon the form of the URL:
> {
> 	KParts::URLArgs args;
> 	args.serviceType = "text/xml";
> 	m_pPart->browserExtension()->setURLArgs( args );
>
> 	m_pPart->begin();
> 	m_pPart->write( sXML );
> 	m_pPart->end();
> }

1) <?xml-stylesheet href="dict_web.css" type="text/css"?>
2) <?xml-stylesheet href="file://dict_web.css" type="text/css"?>
3) <?xml-stylesheet href="file:/home/ellis/xml2/dict4/test/dict_web.css" 
type="text/css"?>

(1) crashes with the following kdDebug output:
khtml (memory): KHTMLPart::clear() this = 0x80db760
kdecore (KURL): KURL couldn't parse URL "dict_web.css"
kdecore (KURL): KURL couldn't parse URL "dict_web.css"
kdecore (KURL): KURL couldn't parse URL "dict_web.css"
khtml (cache): Cache: Malformed url: dict_web.css
KCrash: crashing.... crashRecursionCounter = 2
KCrash: Application Name = lt-dict path = <unknown> pid = 2276
trying to open styleStr..: HighColor
got (nil)

(2) displays the XML unformatted -- as does any invalid href.  kdDebug output:
kio (KIOJob): error 11 //dict_web.css

(3) displays correctly, but I want to use relative paths instead of 
absolute...



When using openURL, (1) works correctly.  kdDebug output is as follows:

KHTMLMainWindow::openURL( file:/home/ellis/xml2/dict4/test/phrase.xml )  
KHTMLDataPart::openURL( file:/home/ellis/xml2/dict4/test/phrase.xml )  
khtml (part): KHTMLPart::openURL file:/home/ellis/xml2/dict4/test/phrase.xml  
khtml (part): closing old URL
khtml (part): KHTMLPart::openURL now (before started) m_url = 
file:/home/ellis/xml2/dict4/test/phrase.xml  
khtml (memory): KHTMLPart::clear() this = 0x80db728
khtml (part): SSL in use?
khtml (part): setIcon unlock done.
kdecore (KURL): KURL couldn't parse URL "dict_web.css"


Do you know what does one need to do to get relative paths working for 
stylesheets when not using openURL()?

Thanks again!
Ellis

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic