/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.Parser#parseStyleSheet(InputSource)}. */ public void parseStyleSheet(InputSource source) throws CSSException, IOException { parser.parseStyleSheet(source); }
public SelectorList parseSelectors(final InputSource source) throws IOException { final HandlerBase handler = new HandlerBase(); parser_.setDocumentHandler(handler); return parser_.parseSelectors(source); }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.Parser#setConditionFactory(ConditionFactory)}. */ public void setConditionFactory(ConditionFactory conditionFactory) { parser.setConditionFactory(conditionFactory); }
private void parse(String snippet) throws CSSException { try { BufferedReader reader = new BufferedReader(new StringReader(snippet)); InputSource source = new InputSource(reader); Parser p = new SACParserCSS2(); p.setDocumentHandler(this); p.parseStyleSheet(source); reader.close(); } catch (IOException ex) { throw new CSSException(ex); } } }
StyleSheet parse( InputStream inputStream, String uri, ResourceLoader loader ) throws CSSException, IOException { InputSource source = new InputSource(); source.setByteStream( inputStream ); source.setEncoding( CSS_ENCODING ); source.setURI( uri ); parser.setConditionFactory( new ConditionFactoryImpl( this ) ); parser.setSelectorFactory( new SelectorFactoryImpl( this ) ); DocumentHandlerImpl documentHandler = new DocumentHandlerImpl( this, loader ); parser.setDocumentHandler( documentHandler ); parser.setErrorHandler( new ErrorHandlerImpl( this ) ); // TODO [rst] Batik parser throws ParseException try { parser.parseStyleSheet( source ); } catch( ParseException e ) { throw new CSSException( e ); } return documentHandler.getStyleSheet(); }
public void parseStyleDeclaration(final CSSStyleDeclaration sd, final InputSource source) throws IOException { final Stack<Object> nodeStack = new Stack<Object>(); nodeStack.push(sd); final CSSOMHandler handler = new CSSOMHandler(nodeStack); parser_.setDocumentHandler(handler); parser_.parseStyleDeclaration(source); }
public CSSValue parsePropertyValue(final InputSource source) throws IOException { final CSSOMHandler handler = new CSSOMHandler(); parser_.setDocumentHandler(handler); final LexicalUnit lu = parser_.parsePropertyValue(source); if (null == lu) { return null; } return new CSSValueImpl(lu); }
/** * Return SAC {@link Parser} to use. * * @return */ public Parser getParser() { if (parser == null) try { parser = getSACParserFactory().makeParser(); if (conditionFactory != null) parser.setConditionFactory(conditionFactory); if (selectorFactory != null) parser.setSelectorFactory(selectorFactory); } catch (Exception e) { // TODO : manage error. // e.printStackTrace(); throw new ParserNotFoundException(e); } return parser; }
parser.setDocumentHandler( handler ); parser.setErrorHandler( handler ); parser.parseStyleSheet( inputSource );
public CSSRule parseRule(final InputSource source) throws IOException { final CSSOMHandler handler = new CSSOMHandler(); parser_.setDocumentHandler(handler); parser_.parseRule(source); return (CSSRule) handler.getRoot(); }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.Parser#setDocumentHandler(DocumentHandler)}. */ public void setDocumentHandler(DocumentHandler handler) { parser.setDocumentHandler(handler); }
/** * <b>SAC</b>: Implements {@link org.w3c.css.sac.Parser#parseSelectors(InputSource)}. */ public SelectorList parseSelectors(InputSource source) throws CSSException, IOException { return parser.parseSelectors(source); }
/** * <b>SAC</b>: Implements * {@link org.w3c.css.sac.Parser#parsePropertyValue(InputSource)}. */ public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, IOException { return parser.parsePropertyValue(source); }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.Parser#parseStyleDeclaration(InputSource)}. */ public void parseStyleDeclaration(InputSource source) throws CSSException, IOException { parser.parseStyleDeclaration(source); }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.Parser#setSelectorFactory(SelectorFactory)}. */ public void setSelectorFactory(SelectorFactory selectorFactory) { parser.setSelectorFactory(selectorFactory); }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.Parser#setErrorHandler(ErrorHandler)}. */ public void setErrorHandler(ErrorHandler handler) { parser.setErrorHandler(handler); }
/** * <b>SAC</b>: Implements {@link org.w3c.css.sac.Parser#parseRule(InputSource)}. */ public void parseRule(InputSource source) throws CSSException, IOException { parser.parseRule(source); }
private void parse(String snippet) throws CSSException { try { BufferedReader reader = new BufferedReader(new StringReader(snippet)); InputSource source = new InputSource(reader); Parser p = new SACParserCSS2(); p.setDocumentHandler(this); p.parseStyleSheet(source); reader.close(); } catch (IOException ex) { throw new CSSException(ex); } } }
public void parseStyleDeclaration(CSSStyleDeclaration styleDeclaration, InputSource source) throws IOException { Stack stack = new Stack(); stack.push(styleDeclaration); ExtendedDocumentHandler documentHandler = getDocumentHandlerFactory() .makeDocumentHandler(); documentHandler.setNodeStack(stack); Parser parser = getParser(); parser.setDocumentHandler(documentHandler); parser.parseStyleDeclaration(source); }
public CSSValue parsePropertyValue(InputSource source) throws IOException { Parser parser = getParser(); ExtendedDocumentHandler documentHandler = getDocumentHandlerFactory() .makeDocumentHandler(); parser.setDocumentHandler(documentHandler); return CSSValueFactory.newValue(parser.parsePropertyValue(source)); }