echopointng.stylesheet
Class CssObjectDeclarationParser

java.lang.Object
  extended by echopointng.stylesheet.CssObjectDeclarationParser

public class CssObjectDeclarationParser
extends java.lang.Object

CssObjectDeclarationParser takes CSS object declarations and parse them into their value parts. A CSS object declaration is defined as

 cssobjectdecl  ::= <identifier> '(' <cssobjectvaleq> ')'
 
 cssobjectvaleq ::=     <cssobjectval> { "," cssobjectval }
 
 cssobjectval   ::=   <cssobjectdecl> ||
                      <anystring>  
 
An CSS object declaration can contain child declarations as in
       fillimage(image('imageurl',12px,12px),repeat);
 
This parser only returns the top level values of the outer CSS object declarations. You will need to "reparse" child declarations as required. So in the above example the parser will return the strings :
       "fillimage" "image('imageurl',12px,12px)" "repeat"
 
The object type name will always be in the first array element. In the above example "fillimage" is the object type name.


Constructor Summary
CssObjectDeclarationParser()
           
 
Method Summary
static boolean isCssObjectDeclaration(java.lang.String objDecl)
          Returns true if the objDecl string is in fact in the correct for an CSS object declaration.
static java.lang.String[] parse(java.lang.String objDecl)
          This will parse an CSS object declaration into its top level string components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CssObjectDeclarationParser

public CssObjectDeclarationParser()
Method Detail

parse

public static java.lang.String[] parse(java.lang.String objDecl)
This will parse an CSS object declaration into its top level string components. Any child CSS object declarations will be left in place as a string value, ready for further parsing. If it cannot be parsed, then an empty String[] will be returned. A valid CSS object declaration will always have at least one token which is the object type name.

Parameters:
objDecl - - the CSS object declaration string to be parsed.
Returns:
an array of the values that make up the CSS object declaration or an empty String[] if its cant be parsed.

isCssObjectDeclaration

public static boolean isCssObjectDeclaration(java.lang.String objDecl)
Returns true if the objDecl string is in fact in the correct for an CSS object declaration.

Parameters:
objDecl - - the string to test
Returns:
true if its a CSS object declaration