[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 2:54:00
[Download RAW message or body]

Hi Simon,

Thanks for the tip.  It works perfectly with openURL, but unfortunately not 
with write(), which is what I would rather use instead of writing the XML to 
a file and then openURL()ing that file.  Is there any way to write XML to the 
part and have it displayed correctly?

{
	KParts::URLArgs args;
	args.serviceType = "text/xml";
	m_pPart->browserExtension()->setURLArgs( args );

	m_pPart->begin();
	m_pPart->write( sXML );
	m_pPart->end();
}

Thanks,
Ellis

On Saturday 29 September 2001 02:41 am, Simon Hausmann wrote:
> On Sat, Sep 29, 2001 at 12:28:59AM -0400, Ellis Whitehead wrote:
> > I have an xml file which references a style sheet:
> > 	<?xml-stylesheet href="dict_web.css" type="text/css"?>
> >
> > This works correctly from konqueror, but in an embedded KHTMLPart I'm
> > using, it just displays the file as though there were no style sheet.
> >
> > How do you get KHTMLPart to load and process a style sheet for an xml
> > file?
>
> You have to tell KHTML that you want it to render the given URL as xml
> document, not as html document. This is done by making use of URLArgs
> and the serviceType field of it. Before calling openURL call setURLArgs
> on the browserextension object with an URLArgs object which has the
> serviceType field set to 'text/xml' . It works in Konqueror because Konq
> always tries to figure out the real mimetype of an URL to open, and it
> doesn't keep that information private but propagates it to the part.
>
> Simon

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

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