|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.infinityloop.util.style.CSS2Parser
public class CSS2Parser
Encapsulates a SAC CSS2 parser for convenient use in the using application.
| Field Summary | |
|---|---|
static long |
ctor_calls
|
java.lang.String |
errorContext
Attempt to provide some context information for a potential error. |
static long |
parse_calls
|
| Constructor Summary | |
|---|---|
CSS2Parser()
Creates and initializes a CSS2 parser object. |
|
| Method Summary | |
|---|---|
void |
addMediaFilter(java.lang.String filterName)
Adds a media filter. |
void |
comment(java.lang.String t)
noop implementation, see SAC |
void |
endDocument(org.w3c.css.sac.InputSource is)
noop implementation, see SAC |
void |
endFontFace()
noop implementation, see SAC |
void |
endMedia(org.w3c.css.sac.SACMediaList l)
endMedia implementation, see SAC Decrement skip counter, if needed. |
void |
endPage(java.lang.String name,
java.lang.String pseudo)
endPage implementation, see SAC |
void |
endSelector(org.w3c.css.sac.SelectorList selectors)
endSelector implementation, see SAC |
void |
error(org.w3c.css.sac.CSSParseException e)
Handle an error, see SAC |
void |
fatalError(org.w3c.css.sac.CSSParseException e)
Handle a fatal error, see SAC |
static java.util.Stack |
filterProperties(java.util.Stack props,
CSSPropertyFilter f)
Filters a Stack of properties against a property filter. |
static java.lang.String |
filterPropertyString(java.lang.String propertyString,
CSSPropertyFilter f)
Filters a CSS string of properties against a custom defined property name filter. |
static de.infinityloop.util.style.val.CSSValue |
getCSSValueFromTabDescription(java.lang.String tabDescription)
Creates a CSSListValue from the passed tab description as text |
java.util.Stack |
getErrors()
Retrieves a Stack of errors that may have been occurred during parsing. |
void |
ignorableAtRule(java.lang.String r)
noop implementation, see SAC |
void |
importStyle(java.lang.String uri,
org.w3c.css.sac.SACMediaList l,
java.lang.String ns)
import external stylesheet implementation, see SAC |
static void |
main(java.lang.String[] args)
Class testing, parses the stylesheet in args[0] and prints the result to System.out . |
static java.lang.String |
makePropertyStringFromStack(java.util.Stack props,
CSSUnitsMap unitTable)
Makes a property list string from a stack of properties. |
void |
namespaceDeclaration(java.lang.String pref,
java.lang.String uri)
noop implementation, see SAC |
static org.w3c.css.sac.Parser |
newParserInstance()
creates a new Parser instance. |
java.util.Stack |
parsePropertyList(java.lang.String plist)
Parse a style declaration, passed as string. |
static org.w3c.css.sac.LexicalUnit |
parsePropertyValue(java.lang.String pval)
Parse a property value, passed as string. |
java.util.Stack |
parseStylesheet(InputProxy ip)
Parses a complete external stylesheet. |
void |
property(java.lang.String name,
org.w3c.css.sac.LexicalUnit value,
boolean important)
property implementation, see SAC |
void |
startDocument(org.w3c.css.sac.InputSource is)
noop implementation, see SAC |
void |
startFontFace()
noop implementation, see SAC |
void |
startMedia(org.w3c.css.sac.SACMediaList l)
startMedia implementation, see SAC We check if one of the media in the media list is in the mediaFilter. |
void |
startPage(java.lang.String name,
java.lang.String pseudo)
startPage implementation, see SAC |
void |
startSelector(org.w3c.css.sac.SelectorList selectors)
startSelector implementation, see SAC |
void |
warning(org.w3c.css.sac.CSSParseException e)
Handle a warning, see SAC |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static long ctor_calls
public static long parse_calls
public java.lang.String errorContext
| Constructor Detail |
|---|
public CSS2Parser()
| Method Detail |
|---|
public void addMediaFilter(java.lang.String filterName)
filterName - media identifier to filter (e.g. "print")public static org.w3c.css.sac.Parser newParserInstance()
public java.util.Stack parseStylesheet(InputProxy ip)
throws java.lang.Exception
ip - the source of the stylesheet
java.lang.Exception - of appropriate typepublic java.util.Stack parsePropertyList(java.lang.String plist)
plist - style declaration as CSS string
public static org.w3c.css.sac.LexicalUnit parsePropertyValue(java.lang.String pval)
throws UpcastException
pval - the property value to parse
UpcastExceptionpublic java.util.Stack getErrors()
public void startPage(java.lang.String name,
java.lang.String pseudo)
startPage in interface org.w3c.css.sac.DocumentHandlername - the name of the page (if any, null otherwise)pseudo - the pseudo page (if any, null otherwise)
public void endPage(java.lang.String name,
java.lang.String pseudo)
endPage in interface org.w3c.css.sac.DocumentHandlerpseudo - the pseudo page (if any, null otherwise)public void startSelector(org.w3c.css.sac.SelectorList selectors)
startSelector in interface org.w3c.css.sac.DocumentHandlerselectors - All intended selectors for all declarations.public void endSelector(org.w3c.css.sac.SelectorList selectors)
endSelector in interface org.w3c.css.sac.DocumentHandlerselectors - All intended selectors for all declarations.
public void property(java.lang.String name,
org.w3c.css.sac.LexicalUnit value,
boolean important)
property in interface org.w3c.css.sac.DocumentHandlername - the name of the property.value - the value of the property. All whitespace are stripped.important - is this property important ?
public void importStyle(java.lang.String uri,
org.w3c.css.sac.SACMediaList l,
java.lang.String ns)
importStyle in interface org.w3c.css.sac.DocumentHandleruri - The URI of the imported style sheet.l - The intended destination media for style information.public void startMedia(org.w3c.css.sac.SACMediaList l)
We check if one of the media in the media list is in the mediaFilter. If it is, we parse it, otherwise we skip everything in it by incrementing the skip variable.
startMedia in interface org.w3c.css.sac.DocumentHandlerl - The intended destination media for style information.public void endMedia(org.w3c.css.sac.SACMediaList l)
Decrement skip counter, if needed.
endMedia in interface org.w3c.css.sac.DocumentHandlerl - The intended destination media for style information.public void error(org.w3c.css.sac.CSSParseException e)
error in interface org.w3c.css.sac.ErrorHandlere - The error information encapsulated in a
CSS parse exception.CSSParseExceptionpublic void warning(org.w3c.css.sac.CSSParseException e)
warning in interface org.w3c.css.sac.ErrorHandlere - The warning information encapsulated in a
CSS parse exception.CSSParseExceptionpublic void fatalError(org.w3c.css.sac.CSSParseException e)
fatalError in interface org.w3c.css.sac.ErrorHandlere - The error information encapsulated in a
CSS parse exception.CSSParseExceptionpublic void comment(java.lang.String t)
comment in interface org.w3c.css.sac.DocumentHandlert - The comment.public void ignorableAtRule(java.lang.String r)
ignorableAtRule in interface org.w3c.css.sac.DocumentHandler
public void namespaceDeclaration(java.lang.String pref,
java.lang.String uri)
namespaceDeclaration in interface org.w3c.css.sac.DocumentHandlerpref - null if this is the default namespaceuri - The URI for this namespace.public void startDocument(org.w3c.css.sac.InputSource is)
startDocument in interface org.w3c.css.sac.DocumentHandlerpublic void endDocument(org.w3c.css.sac.InputSource is)
endDocument in interface org.w3c.css.sac.DocumentHandlerpublic void startFontFace()
startFontFace in interface org.w3c.css.sac.DocumentHandlerpublic void endFontFace()
endFontFace in interface org.w3c.css.sac.DocumentHandlerpublic static de.infinityloop.util.style.val.CSSValue getCSSValueFromTabDescription(java.lang.String tabDescription)
tabDescription - the tab description text
public static java.util.Stack filterProperties(java.util.Stack props,
CSSPropertyFilter f)
props - the Stack of propertiesf - a CSSPropertyFilter object configured as desired
CSSPropertyFilter
public static java.lang.String makePropertyStringFromStack(java.util.Stack props,
CSSUnitsMap unitTable)
props - the Stack of propertiesunitTable - a CSSPropertyDefaultUnits object
CSSUnitsMap
public static java.lang.String filterPropertyString(java.lang.String propertyString,
CSSPropertyFilter f)
propertyString - the String you wish to have filteredf - the CSSPropertyFilter object describing which filter action should be performed.
CSSPropertyFilterpublic static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||