Class Parser
java.lang.Object
org.apache.batik.css.parser.Parser
- All Implemented Interfaces:
ExtendedParser, Localizable, org.w3c.css.sac.Parser
This class implements the
Parser interface.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default resource bundle base name.protected org.w3c.css.sac.ConditionFactoryThe condition factory.protected intThe current lexical unit.protected org.w3c.css.sac.DocumentHandlerThe document handler.protected StringThe document URI.protected org.w3c.css.sac.ErrorHandlerThe error handler.protected LocalizableSupportThe localizable support.protected StringTo store the current pseudo element.protected ScannerThe scanner used to scan the input source.protected org.w3c.css.sac.SelectorFactoryThe selector factory. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.w3c.css.sac.CSSParseExceptionCreates a parse exception.protected org.w3c.css.sac.CSSParseExceptioncreateCSSParseException(String key, Object[] params) Creates a parse exception.protected ScannercreateScanner(org.w3c.css.sac.InputSource source) Creates a scanner, given an InputSource.protected org.w3c.css.sac.LexicalUnitdimension(boolean positive, org.w3c.css.sac.LexicalUnit prev) Converts the current lexical unit to a dimension.formatMessage(String key, Object[] args) ImplementsLocalizable.formatMessage(String,Object[]).ImplementsLocalizable.getLocale().SAC: ImplementsParser.getParserVersion().protected org.w3c.css.sac.LexicalUnithexcolor(org.w3c.css.sac.LexicalUnit prev) Converts a hash unit to a RGB color.protected booleanTells whether or not the given string represents a pseudo-element.protected intnext()Advances to the next token, ignoring comments.protected intAdvances to the next token and skip the spaces, ignoring comments.protected floatnumber(boolean positive) Converts the current lexical unit to a float.protected voidParses an unknown rule.protected org.w3c.css.sac.LexicalUnitparseExpression(boolean param) Parses a CSS2 expression.protected voidParses a font-face rule.protected org.w3c.css.sac.LexicalUnitparseFunction(boolean positive, org.w3c.css.sac.LexicalUnit prev) Parses a CSS2 function.protected voidParses an import rule.org.w3c.css.sac.SACMediaListparseMedia(String mediaText) ImplementsExtendedParser.parseMedia(String).protected CSSSACMediaListParses a media list.protected voidParses a media rule.protected voidParses a page rule.booleanparsePriority(String source) ImplementsExtendedParser.parsePriority(String).booleanparsePriority(org.w3c.css.sac.InputSource source) SAC: ImplementsParser.parsePriority(InputSource).protected booleanParses the priority using the current scanner.org.w3c.css.sac.LexicalUnitparsePropertyValue(String source) ImplementsExtendedParser.parsePropertyValue(String).org.w3c.css.sac.LexicalUnitparsePropertyValue(org.w3c.css.sac.InputSource source) SAC: ImplementsParser.parsePropertyValue(InputSource).protected org.w3c.css.sac.LexicalUnitParses property value using the current scanner.protected voidParses a rule.voidImplementsExtendedParser.parseRule(String).voidparseRule(org.w3c.css.sac.InputSource source) SAC: ImplementsParser.parseRule(InputSource).protected voidParses a rule using the current scanner.protected voidParses a ruleset.protected org.w3c.css.sac.SelectorParses a selector.protected org.w3c.css.sac.SelectorListParses a selector listorg.w3c.css.sac.SelectorListparseSelectors(String source) ImplementsExtendedParser.parseSelectors(String).org.w3c.css.sac.SelectorListparseSelectors(org.w3c.css.sac.InputSource source) SAC: ImplementsParser.parseSelectors(InputSource).protected org.w3c.css.sac.SelectorListParses selectors using the current scanner.protected org.w3c.css.sac.SimpleSelectorParses a simple selector.protected voidparseStyleDeclaration(boolean inSheet) Parses the given reader.voidparseStyleDeclaration(String source) ImplementsExtendedParser.parseStyleDeclaration(String).voidparseStyleDeclaration(org.w3c.css.sac.InputSource source) SAC: ImplementsParser.parseStyleDeclaration(InputSource).protected voidParses a style declaration using the current scanner.voidparseStyleSheet(String uri) SAC: ImplementsParser.parseStyleSheet(String).voidparseStyleSheet(org.w3c.css.sac.InputSource source) SAC: ImplementsParser.parseStyleSheet(InputSource).protected org.w3c.css.sac.LexicalUnitparseTerm(org.w3c.css.sac.LexicalUnit prev) Parses a CSS2 term.protected voidreportError(String key) Reports a parsing error.protected voidreportError(String key, Object[] params) Reports a parsing error.protected voidreportError(org.w3c.css.sac.CSSParseException e) Reports a parsing error.voidsetConditionFactory(org.w3c.css.sac.ConditionFactory factory) SAC: ImplementsParser.setConditionFactory(ConditionFactory).voidsetDocumentHandler(org.w3c.css.sac.DocumentHandler handler) SAC: ImplementsParser.setDocumentHandler(DocumentHandler).voidsetErrorHandler(org.w3c.css.sac.ErrorHandler handler) SAC: ImplementsParser.setErrorHandler(ErrorHandler).voidSAC: ImplementsParser.setLocale(Locale).voidsetSelectorFactory(org.w3c.css.sac.SelectorFactory factory) SAC: ImplementsParser.setSelectorFactory(SelectorFactory).protected intSkips the white spaces.protected intSkips the white spaces and CDO/CDC units.
-
Field Details
-
BUNDLE_CLASSNAME
-
localizableSupport
The localizable support. -
scanner
The scanner used to scan the input source. -
current
protected int currentThe current lexical unit. -
documentHandler
protected org.w3c.css.sac.DocumentHandler documentHandlerThe document handler. -
selectorFactory
protected org.w3c.css.sac.SelectorFactory selectorFactoryThe selector factory. -
conditionFactory
protected org.w3c.css.sac.ConditionFactory conditionFactoryThe condition factory. -
errorHandler
protected org.w3c.css.sac.ErrorHandler errorHandlerThe error handler. -
pseudoElement
To store the current pseudo element. -
documentURI
The document URI.
-
-
Constructor Details
-
Parser
public Parser()
-
-
Method Details
-
getParserVersion
SAC: ImplementsParser.getParserVersion().- Specified by:
getParserVersionin interfaceorg.w3c.css.sac.Parser- Returns:
- "http://www.w3.org/TR/REC-CSS2".
-
setLocale
SAC: ImplementsParser.setLocale(Locale).- Specified by:
setLocalein interfaceLocalizable- Specified by:
setLocalein interfaceorg.w3c.css.sac.Parser- Parameters:
locale- The locale to set.- Throws:
org.w3c.css.sac.CSSException
-
getLocale
ImplementsLocalizable.getLocale().- Specified by:
getLocalein interfaceLocalizable
-
formatMessage
ImplementsLocalizable.formatMessage(String,Object[]).- Specified by:
formatMessagein interfaceLocalizable- Parameters:
key- The key used to retreive the message from the resource bundle.args- The objects that compose the message.- Throws:
MissingResourceException- if the key is not in the bundle.
-
setDocumentHandler
public void setDocumentHandler(org.w3c.css.sac.DocumentHandler handler) SAC: ImplementsParser.setDocumentHandler(DocumentHandler).- Specified by:
setDocumentHandlerin interfaceorg.w3c.css.sac.Parser
-
setSelectorFactory
public void setSelectorFactory(org.w3c.css.sac.SelectorFactory factory) SAC: ImplementsParser.setSelectorFactory(SelectorFactory).- Specified by:
setSelectorFactoryin interfaceorg.w3c.css.sac.Parser
-
setConditionFactory
public void setConditionFactory(org.w3c.css.sac.ConditionFactory factory) SAC: ImplementsParser.setConditionFactory(ConditionFactory).- Specified by:
setConditionFactoryin interfaceorg.w3c.css.sac.Parser
-
setErrorHandler
public void setErrorHandler(org.w3c.css.sac.ErrorHandler handler) SAC: ImplementsParser.setErrorHandler(ErrorHandler).- Specified by:
setErrorHandlerin interfaceorg.w3c.css.sac.Parser
-
parseStyleSheet
public void parseStyleSheet(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException SAC: ImplementsParser.parseStyleSheet(InputSource).- Specified by:
parseStyleSheetin interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parseStyleSheet
SAC: ImplementsParser.parseStyleSheet(String).- Specified by:
parseStyleSheetin interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parseStyleDeclaration
public void parseStyleDeclaration(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException SAC: ImplementsParser.parseStyleDeclaration(InputSource).- Specified by:
parseStyleDeclarationin interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parseStyleDeclarationInternal
Parses a style declaration using the current scanner.- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parseRule
public void parseRule(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException SAC: ImplementsParser.parseRule(InputSource).- Specified by:
parseRulein interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parseRuleInternal
Parses a rule using the current scanner.- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parseSelectors
public org.w3c.css.sac.SelectorList parseSelectors(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException SAC: ImplementsParser.parseSelectors(InputSource).- Specified by:
parseSelectorsin interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parseSelectorsInternal
protected org.w3c.css.sac.SelectorList parseSelectorsInternal() throws org.w3c.css.sac.CSSException, IOExceptionParses selectors using the current scanner.- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parsePropertyValue
public org.w3c.css.sac.LexicalUnit parsePropertyValue(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException SAC: ImplementsParser.parsePropertyValue(InputSource).- Specified by:
parsePropertyValuein interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parsePropertyValueInternal
protected org.w3c.css.sac.LexicalUnit parsePropertyValueInternal() throws org.w3c.css.sac.CSSException, IOExceptionParses property value using the current scanner.- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parsePriority
public boolean parsePriority(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException SAC: ImplementsParser.parsePriority(InputSource).- Specified by:
parsePriorityin interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parsePriorityInternal
Parses the priority using the current scanner.- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parseRule
protected void parseRule()Parses a rule. -
parseAtRule
protected void parseAtRule()Parses an unknown rule. -
parseImportRule
protected void parseImportRule()Parses an import rule. Assumes the current token is '@import'. -
parseMediaList
Parses a media list. -
parseFontFaceRule
protected void parseFontFaceRule()Parses a font-face rule. -
parsePageRule
protected void parsePageRule()Parses a page rule. -
parseMediaRule
protected void parseMediaRule()Parses a media rule. -
parseRuleSet
protected void parseRuleSet()Parses a ruleset. -
parseSelectorList
protected org.w3c.css.sac.SelectorList parseSelectorList()Parses a selector list -
parseSelector
protected org.w3c.css.sac.Selector parseSelector()Parses a selector. -
parseSimpleSelector
protected org.w3c.css.sac.SimpleSelector parseSimpleSelector()Parses a simple selector. -
isPseudoElement
Tells whether or not the given string represents a pseudo-element. -
parseStyleDeclaration
protected void parseStyleDeclaration(boolean inSheet) throws org.w3c.css.sac.CSSException Parses the given reader.- Throws:
org.w3c.css.sac.CSSException
-
parseExpression
protected org.w3c.css.sac.LexicalUnit parseExpression(boolean param) Parses a CSS2 expression.- Parameters:
param- whether the expression to be parsed is a function parameter
-
parseTerm
protected org.w3c.css.sac.LexicalUnit parseTerm(org.w3c.css.sac.LexicalUnit prev) Parses a CSS2 term. -
parseFunction
protected org.w3c.css.sac.LexicalUnit parseFunction(boolean positive, org.w3c.css.sac.LexicalUnit prev) Parses a CSS2 function. -
hexcolor
protected org.w3c.css.sac.LexicalUnit hexcolor(org.w3c.css.sac.LexicalUnit prev) Converts a hash unit to a RGB color. -
createScanner
Creates a scanner, given an InputSource. -
skipSpaces
protected int skipSpaces()Skips the white spaces. -
skipSpacesAndCDOCDC
protected int skipSpacesAndCDOCDC()Skips the white spaces and CDO/CDC units. -
number
protected float number(boolean positive) Converts the current lexical unit to a float. -
dimension
protected org.w3c.css.sac.LexicalUnit dimension(boolean positive, org.w3c.css.sac.LexicalUnit prev) Converts the current lexical unit to a dimension. -
next
protected int next()Advances to the next token, ignoring comments. -
nextIgnoreSpaces
protected int nextIgnoreSpaces()Advances to the next token and skip the spaces, ignoring comments. -
reportError
Reports a parsing error. -
reportError
-
reportError
protected void reportError(org.w3c.css.sac.CSSParseException e) Reports a parsing error. -
createCSSParseException
Creates a parse exception. -
createCSSParseException
-
parseStyleDeclaration
ImplementsExtendedParser.parseStyleDeclaration(String).- Specified by:
parseStyleDeclarationin interfaceExtendedParser- Parameters:
source- The declaration.- Throws:
org.w3c.css.sac.CSSException- Any CSS exception, possibly wrapping another exception.IOException- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
-
parseRule
ImplementsExtendedParser.parseRule(String).- Specified by:
parseRulein interfaceExtendedParser- Throws:
org.w3c.css.sac.CSSException- Any CSS exception, possibly wrapping another exception.IOException- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
-
parseSelectors
public org.w3c.css.sac.SelectorList parseSelectors(String source) throws org.w3c.css.sac.CSSException, IOException ImplementsExtendedParser.parseSelectors(String).- Specified by:
parseSelectorsin interfaceExtendedParser- Throws:
org.w3c.css.sac.CSSException- Any CSS exception, possibly wrapping another exception.IOException- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
-
parsePropertyValue
public org.w3c.css.sac.LexicalUnit parsePropertyValue(String source) throws org.w3c.css.sac.CSSException, IOException ImplementsExtendedParser.parsePropertyValue(String).- Specified by:
parsePropertyValuein interfaceExtendedParser- Throws:
org.w3c.css.sac.CSSException- Any CSS exception, possibly wrapping another exception.IOException- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
-
parsePriority
ImplementsExtendedParser.parsePriority(String).- Specified by:
parsePriorityin interfaceExtendedParser- Throws:
org.w3c.css.sac.CSSException- Any CSS exception, possibly wrapping another exception.IOException- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
-
parseMedia
public org.w3c.css.sac.SACMediaList parseMedia(String mediaText) throws org.w3c.css.sac.CSSException, IOException ImplementsExtendedParser.parseMedia(String).- Specified by:
parseMediain interfaceExtendedParser- Throws:
org.w3c.css.sac.CSSException- Any CSS exception, possibly wrapping another exception.IOException- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
-