Adding CSS

If you use the CssResolverPipeline with the default CSSResolver there are 4 ways to add CSS to the XML Worker:

How to add a CSS File to the CSSResolver

If you have the CSS File as an InputStream or as an URL, you can use the FileRetrieveImpl class in combination with the CssFileProcessor

	FileRetrieve retrieve = new FileRetrieveImpl();
	CssFileProcessor cssFileProcessor = new CssFileProcessor();
	retrieve.processFromStream(stream, cssFileProcessor);
	CssFile css = cssFileProcessor.getCss();
	cssResolver.addCssFile(css);

You could also add the CSS from a String through the addCssFile(final String href, final boolean isPersistent) method. The isPersistent parameter is their to indicate that the added CSS should remain in the CssResolver during subsequent parses of HTML with the same XMLWorker. If isPersistent is false the added Css will be removed on the XMLWorkers call to the CssPipeline's init method which is called for every new HTML that is parsed.