/** * <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#setDocumentHandler(DocumentHandler)}. */ public void setDocumentHandler(DocumentHandler handler) { parser.setDocumentHandler(handler); }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.Parser#setDocumentHandler(DocumentHandler)}. */ public void setDocumentHandler(DocumentHandler handler) { parser.setDocumentHandler(handler); }
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 SelectorList parseSelectors(final InputSource source) throws IOException { final HandlerBase handler = new HandlerBase(); parser_.setDocumentHandler(handler); return parser_.parseSelectors(source); }
public SACMediaList parseMedia(final InputSource source) throws IOException { final HandlerBase handler = new HandlerBase(); parser_.setDocumentHandler(handler); if (parser_ instanceof AbstractSACParser) { return ((AbstractSACParser) parser_).parseMedia(source); } return null; }
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); } } }
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); } } }
private String parse() throws IOException { InputStreamReader reader2 = new InputStreamReader(_cssUrl.openStream()); InputSource source2 = new InputSource(reader2); Parser p = new SACParserCSS2(); CssDocumentHandlerImpl handler = new CssDocumentHandlerImpl(_context, _parentBundle); p.setDocumentHandler(handler); p.parseStyleSheet(source2); reader2.close(); return handler.getResults(); }
private String parse() throws IOException { InputStreamReader reader2 = new InputStreamReader(_cssUrl.openStream()); InputSource source2 = new InputSource(reader2); Parser p = new SACParserCSS2(); CssDocumentHandlerImpl handler = new CssDocumentHandlerImpl(_context, _parentBundle); p.setDocumentHandler(handler); p.parseStyleSheet(source2); reader2.close(); return handler.getResults(); }
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); }
/***************************************************************************** * Private Methods ****************************************************************************/ private String parse(ResourceService resourceService, URL url) throws IOException { InputStreamReader reader2 = new InputStreamReader(url.openStream()); InputSource source2 = new InputSource(reader2); Parser p = new SACParserCSS2(); CssDocumentHandler handler = new CssDocumentHandler(resourceService,_locale); p.setDocumentHandler(handler); p.parseStyleSheet(source2); reader2.close(); return handler.getResults(); } }
public CSSRule parseRule(final InputSource source) throws IOException { final CSSOMHandler handler = new CSSOMHandler(); parser_.setDocumentHandler(handler); parser_.parseRule(source); return (CSSRule) handler.getRoot(); }
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); }
/***************************************************************************** * Private Methods ****************************************************************************/ private String parse(ResourceService resourceService, URL url) throws IOException { InputStreamReader reader2 = new InputStreamReader(url.openStream()); InputSource source2 = new InputSource(reader2); Parser p = new SACParserCSS2(); CssDocumentHandler handler = new CssDocumentHandler(resourceService,_locale); p.setDocumentHandler(handler); p.parseStyleSheet(source2); reader2.close(); return handler.getResults(); } }
public SelectorList parseSelectors(InputSource source) throws IOException { ExtendedDocumentHandler documentHandler = getDocumentHandlerFactory() .makeDocumentHandler(); Parser parser = getParser(); parser.setDocumentHandler(documentHandler); return parser.parseSelectors(source); }
/** * Parses a SAC input source into a CSSOM style sheet. * * @param source the SAC input source * @param ownerNode the owner node (see the definition of * <code>ownerNode</code> in org.w3c.dom.css.StyleSheet) * @param href the href (see the definition of <code>href</code> in * org.w3c.dom.css.StyleSheet) * @return the CSSOM style sheet * @throws IOException if the underlying SAC parser throws an IOException */ public CSSStyleSheet parseStyleSheet(final InputSource source, final Node ownerNode, final String href) throws IOException { final CSSOMHandler handler = new CSSOMHandler(); handler.setOwnerNode(ownerNode); handler.setHref(href); parser_.setDocumentHandler(handler); parser_.parseStyleSheet(source); final Object o = handler.getRoot(); if (o instanceof CSSStyleSheet) { return (CSSStyleSheet) o; } return null; }
public CSSValue parsePropertyValue(InputSource source) throws IOException { Parser parser = getParser(); ExtendedDocumentHandler documentHandler = getDocumentHandlerFactory() .makeDocumentHandler(); parser.setDocumentHandler(documentHandler); return CSSValueFactory.newValue(parser.parsePropertyValue(source)); }
public CSSStyleSheet parseStyleSheet(InputSource source) throws IOException { ExtendedDocumentHandler documentHandler = getDocumentHandlerFactory() .makeDocumentHandler(); Parser parser = getParser(); parser.setDocumentHandler(documentHandler); parser.parseStyleSheet(source); return (CSSStyleSheet) documentHandler.getNodeRoot(); }
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(); }