/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.Parser#parseStyleSheet(InputSource)}. */ public void parseStyleSheet(InputSource source) throws CSSException, IOException { parser.parseStyleSheet(source); }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.Parser#parseStyleSheet(InputSource)}. */ public void parseStyleSheet(InputSource source) throws CSSException, IOException { parser.parseStyleSheet(source); }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.Parser#parseStyleSheet(InputSource)}. */ public void parseStyleSheet(InputSource source) throws CSSException, IOException { parser.parseStyleSheet(source); }
/** * Parse a CSS document from a URI. * * <p>This method is a shortcut for the common case of reading a document * from a URI. It is the exact equivalent of the following:</p> * * <pre> * parse(new InputSource(uri)); * </pre> * * <p>The URI must be fully resolved by the application before it is passed * to the parser.</p> * * @param uri The URI. * @exception CSSException Any CSS exception, possibly * wrapping another exception. * @exception java.io.IOException An IO exception from the parser, * possibly from a byte stream or character stream * supplied by the application. * @see #parseStyleSheet(InputSource) */ public void parseStyleSheet(String uri) throws CSSException, IOException { parser.parseStyleSheet(uri); }
/** * Parse a CSS document from a URI. * * <p>This method is a shortcut for the common case of reading a document * from a URI. It is the exact equivalent of the following:</p> * * <pre> * parse(new InputSource(uri)); * </pre> * * <p>The URI must be fully resolved by the application before it is passed * to the parser.</p> * * @param uri The URI. * @exception CSSException Any CSS exception, possibly * wrapping another exception. * @exception java.io.IOException An IO exception from the parser, * possibly from a byte stream or character stream * supplied by the application. * @see #parseStyleSheet(InputSource) */ public void parseStyleSheet(String uri) throws CSSException, IOException { parser.parseStyleSheet(uri); }
/** * Parse a CSS document from a URI. * * <p>This method is a shortcut for the common case of reading a document * from a URI. It is the exact equivalent of the following:</p> * * <pre> * parse(new InputSource(uri)); * </pre> * * <p>The URI must be fully resolved by the application before it is passed * to the parser.</p> * * @param uri The URI. * @exception CSSException Any CSS exception, possibly * wrapping another exception. * @exception java.io.IOException An IO exception from the parser, * possibly from a byte stream or character stream * supplied by the application. * @see #parseStyleSheet(InputSource) */ public void parseStyleSheet(String uri) throws CSSException, IOException { parser.parseStyleSheet(uri); }
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(); }
/***************************************************************************** * 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(); } }
/***************************************************************************** * 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(); } }
/** * 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 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(); }
final InputSource inputSource = new InputSource(); inputSource.setByteStream( stream ); parser.parseStyleSheet( inputSource );