org.milyn.css
Class CSSStyleScraper

java.lang.Object
  extended by org.milyn.css.CSSStyleScraper
All Implemented Interfaces:
ContentHandler, DOMElementVisitor, DOMVisitAfter, DOMVisitBefore, DOMVisitor, Visitor

@Phase(value=ASSEMBLY)
public class CSSStyleScraper
extends Object
implements DOMElementVisitor

CSS scraping Assembly Unit.

Gathers CSS information during the Assembly phase. This information is then available during the Processing phase.

Triggered on <style> and <link> elements. Reads and parses the referenced CSS using the Magger CSSParser. Makes the gathered CSS data available to processing units via the CSSAccessor class.

Configuration

 <resource-config selector="style">
  <resource>org.milyn.css.CSSStyleScraper</resource>

  <!-- (Optional) Only filter the CSS if the 'media' attribute lists
                one of the requesting devices profiles. Default true. -->
        <param name="checkMediaAttribute">true/false</param>

        <!-- (Optional) Only filter the CSS if the 'type' attribute equals
                'text/css'. Default true. -->
        <param name="checkTypeAttribute">true/false</param>
 </resource-config>

 <resource-config selector="link">
  <resource>org.milyn.css.CSSStyleScraper</resource>

        <!-- (Optional) Only filter the CSS if the 'media' attribute, if present, lists
                one of the requesting devices profiles. Default true. -->
        <param name="checkMediaAttribute">true/false</param>

        <!-- (Optional) Only filter the CSS if the 'type' attribute, if present, equals
                'text/css'. Default true. -->
        <param name="checkTypeAttribute">true/false</param>

        <!-- (Optional) Only filter the CSS if the 'rel' attribute, if present,
                contains the keyword 'stylesheet'. Default true. -->
        <param name="checkRelAttributeForStylesheet">true/false</param>

        <!-- (Optional) Only filter the CSS if the 'rel' attribute, if present,
                does not contains the keyword 'alternate'. Default true. -->
        <param name="checkRelAttributeForAlternate">true/false</param>
 </resource-config>
See SmooksResourceConfiguration.

Author:
tfennelly

Constructor Summary
CSSStyleScraper()
           
 
Method Summary
 void setConfiguration(SmooksResourceConfiguration resourceConfig)
           
 void visitAfter(Element element, ExecutionContext request)
           
 void visitBefore(Element element, ExecutionContext executionContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSSStyleScraper

public CSSStyleScraper()
Method Detail

setConfiguration

public void setConfiguration(SmooksResourceConfiguration resourceConfig)
                      throws SmooksConfigurationException
Throws:
SmooksConfigurationException

visitBefore

public void visitBefore(Element element,
                        ExecutionContext executionContext)
Specified by:
visitBefore in interface DOMVisitBefore

visitAfter

public void visitAfter(Element element,
                       ExecutionContext request)
Specified by:
visitAfter in interface DOMVisitAfter


Copyright © 2008. All Rights Reserved.