|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.w3c.mwi.mobileok.basic.DecodedContent
org.w3c.mwi.mobileok.basic.TextContent
org.w3c.mwi.mobileok.basic.CssContent
public class CssContent
Represents a CSS content.
The class extends TextContent to add CSS validation.
CSS styles may appear in different forms in a Web resource:
style attributesstyle elements in the markupThis class is used to represent the three kinds of forms. The underlying RetrievalElement should be used to tell the difference:
FragmentRetrievalElement whose FragmentRetrievalElement.getBoxType()
method returns FragmentBoxType.Block identifies embedded CSS stylesFragmentRetrievalElement whose FragmentRetrievalElement.getBoxType()
method returns FragmentBoxType.Inline identifies inline CSS stylesRetrievalElement identify an external stylesheet
| Nested Class Summary | |
|---|---|
static class |
CssContent.CssType
Describes the different types of CSS content that may be handled. |
| Field Summary | |
|---|---|
private java.lang.String |
css
Original CSS styles as a string. |
private java.util.List<ValidationLineAndColumnMessage> |
cssErrorMessageList
List of CSS validation errors. |
private java.util.List<ValidationLineAndColumnMessage> |
cssWarningMessageList
List of CSS validation warnings. |
private int |
extraneousChars
Number of non-significant whitespaces and comments in the CSS. |
private java.lang.String |
processedCSS
CSS styles once processed. |
private CssContent.CssType |
type
Type of CSS represented by this instance. |
| Constructor Summary | |
|---|---|
CssContent(java.net.URI uri,
java.util.List<RetrievalElement> retrieved)
Creates a class instance bound to the URI of a CSS resource. |
|
| Method Summary | |
|---|---|
java.lang.String |
getCSS()
Returns the raw CSS string that was retrieved using HTTP. |
java.util.List<ValidationLineAndColumnMessage> |
getCSSErrorMessageList()
Returns the list of CSS validation error messages. |
java.util.List<ValidationLineAndColumnMessage> |
getCSSWarningMessageList()
Returns the list of CSS validation warnings. |
int |
getExtraneousChars()
Returns the number of non significant whitespaces and comments in the CSS. |
java.lang.String |
getProcessedCSS()
Returns the CSS style, viewed from a mobileOK point of view, and prepared for CSS validation. |
int |
getTotalChars()
Returns the number of characters in the original CSS block. |
CssContent.CssType |
getType()
Returns the type of CSS this instance represents. |
private void |
insertLineInCssMessages(RetrievalElement retrieved)
Appends the index of the line that contains the inline CSS style in each CSS validation error and/or warning message. |
boolean |
isValid()
Returns true if the CSS is valid. |
org.w3c.dom.Node |
toMokiNode(org.w3c.dom.Document document,
org.w3c.dom.Node parent)
Serializes the content to its moki representation as a DOM
node. |
| Methods inherited from class org.w3c.mwi.mobileok.basic.TextContent |
|---|
getBody, getUTF8ErrorMessageList |
| Methods inherited from class org.w3c.mwi.mobileok.basic.DecodedContent |
|---|
addByteErrorMessages, addLineAndColumnMessages |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.List<ValidationLineAndColumnMessage> cssErrorMessageList
private java.util.List<ValidationLineAndColumnMessage> cssWarningMessageList
private final java.lang.String css
private final java.lang.String processedCSS
private int extraneousChars
private CssContent.CssType type
| Constructor Detail |
|---|
CssContent(java.net.URI uri,
java.util.List<RetrievalElement> retrieved)
throws TestException
The content is validated while it is instantiated.
uri - absolute URI of the resource.retrieved - the retrieved representation of the resource.
TestException - an unexpected error occurred while retrieving
the resource.| Method Detail |
|---|
private void insertLineInCssMessages(RetrievalElement retrieved)
The method only adds the line number when the CSS style being considered is an inline CSS style contained within another resource.
retrieved - the last retrieved exchange that represents the resource.public boolean isValid()
true if the CSS is valid.
isValid in class TextContentpublic java.util.List<ValidationLineAndColumnMessage> getCSSErrorMessageList()
public java.util.List<ValidationLineAndColumnMessage> getCSSWarningMessageList()
public java.lang.String getCSS()
public java.lang.String getProcessedCSS()
CSSUtils.preprocessBody(URI, String, java.util.Collection)public int getTotalChars()
public int getExtraneousChars()
public CssContent.CssType getType()
public org.w3c.dom.Node toMokiNode(org.w3c.dom.Document document,
org.w3c.dom.Node parent)
moki representation as a DOM
node.
toMokiNode in class TextContentdocument - DOM document the created node should belong toparent - DOM node to which the representation should be appended.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||