|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.mwi.mobileok.basic.CssResourceExtractor
public class CssResourceExtractor
Extracts CSS resources referenced by the given resource that apply to the
handheld
or all
media type.
3 types of CSS resources may be returned:
style
elements.style
attributes of various elements.The extractor runs on XHTML web pages.
URIs whose scheme is not supported are ignored. As far as mobileOK
is concerned, this means that URIs must use the scheme HTTP
or HTTPS
, but note the code actually relies on the list of
ResourceRetriever
defined in TesterConfiguration
.
Constructor Summary | |
---|---|
CssResourceExtractor()
Default constructor. |
Method Summary | |
---|---|
private java.util.List<Resource> |
extractEmbeddedCSS(org.w3c.dom.Document theDOM,
java.net.URI parentUri,
int parentDepth)
Extracts the list of CSS Styles defined in style
elements in the given DOM document. |
private java.util.List<java.net.URI> |
extractExternalCss(java.net.URI baseURI,
org.w3c.dom.Document theDOM)
Extracts the list of URIs of the CSS stylesheets referenced in the given DOM document. |
private java.util.List<Resource> |
extractInlineCSS(org.w3c.dom.Document theDOM,
java.net.URI parentUri,
int parentDepth)
Extracts the list of CSS Styles defined in style
attributes in the given DOM document. |
java.util.List<Resource> |
extractResources(Resource resource,
java.util.List<Resource> knownResources)
Extracts additional resources from the given one. |
private void |
processEmbeddedCSS(org.w3c.dom.NodeList nodeList,
java.util.Collection<java.lang.String> embeddedCSS)
Parses the list of style elements and adds the content
of the elements that apply to the handheld , the
all or to any media type. |
private void |
processInlineCSS(org.w3c.dom.NodeList nodeList,
java.util.Map<java.lang.String,java.lang.Integer> inlineCSS)
Parses the list of elements in search of style attributes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CssResourceExtractor()
Method Detail |
---|
public java.util.List<Resource> extractResources(Resource resource, java.util.List<Resource> knownResources)
ResourceExtractor
The extracted resources may contain resources that have already been previously extracted, but known resources should not be automatically copied to the returned list.
extractResources
in interface ResourceExtractor
resource
- resource to parse.knownResources
- list of known resources.
null
when no resources were extracted.private java.util.List<java.net.URI> extractExternalCss(java.net.URI baseURI, org.w3c.dom.Document theDOM)
Such stylesheets are defined in:
xml-stylesheet
processing instructionslink
elements with specific attributes
baseURI
- base URI against which relative URIS should be resolved.theDOM
- the DOM document to parse.
private java.util.List<Resource> extractEmbeddedCSS(org.w3c.dom.Document theDOM, java.net.URI parentUri, int parentDepth)
style
elements in the given DOM document.
theDOM
- the DOM document to parse.parentUri
- URI of the resource being parsed.parentDepth
- depth of the resource being parsed.
style
element.private void processEmbeddedCSS(org.w3c.dom.NodeList nodeList, java.util.Collection<java.lang.String> embeddedCSS)
style
elements and adds the content
of the elements that apply to the handheld
, the
all
or to any media type.
nodeList
- the list of style
elements to parse.embeddedCSS
- the list of embedded CSS styles to complete.private java.util.List<Resource> extractInlineCSS(org.w3c.dom.Document theDOM, java.net.URI parentUri, int parentDepth)
style
attributes in the given DOM document.
theDOM
- the DOM document to parse.parentUri
- URI of the resource being parsed.parentDepth
- depth of the resource being parsed.
style
attribute.private void processInlineCSS(org.w3c.dom.NodeList nodeList, java.util.Map<java.lang.String,java.lang.Integer> inlineCSS)
style
attributes.
nodeList
- the list of elements to parse
(and that should contain a style
attribute).inlineCSS
- the list of inline CSS styles to complete.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |