/** * Create a new input source with a URI. * * <p>The URI must be full resolved.</p> * * @param uri The URI. * @see #setURI * @see #setByteStream * @see #setEncoding * @see #setCharacterStream */ public InputSource(String uri) { setURI(uri); }
/** * Create a new input source with a URI. * * <p>The URI must be full resolved.</p> * * @param uri The URI. * @see #setURI * @see #setByteStream * @see #setEncoding * @see #setCharacterStream */ public InputSource(String uri) { setURI(uri); }
@Override public InputSource resolve(String identifier) { // identifier should not have .scss, fileName should String ext = ".scss"; if (identifier.endsWith(".css")) { ext = ".css"; } String fileName = identifier; if (identifier.endsWith(ext)) { identifier = identifier.substring(0, identifier.length() - ext.length()); } else { fileName = fileName + ext; } try { InputStream is = new FileInputStream(fileName); InputSource source = new InputSource(); source.setByteStream(is); source.setURI(fileName); return source; } catch (FileNotFoundException e) { // not found, try something else return null; } }
InputSource source = new InputSource(); source.setByteStream(is); source.setURI(fileName); return source;
/** * Creates a new stylesheet representing the CSS stylesheet for the specified input source. * @param element the owning node * @param source the input source which contains the CSS stylesheet which this stylesheet host object represents * @param uri this stylesheet's URI (used to resolved contained @import rules) */ public Stylesheet(final HTMLElement element, final InputSource source, final String uri) { if (source.getURI()==null) source.setURI(uri); setParentScope(element.getWindow()); setPrototype(getPrototype(Stylesheet.class)); wrapped_ = parseCSS(source); uri_ = uri; ownerNode_ = element; }
/** * Creates a new stylesheet representing the CSS stylesheet for the specified input source. * @param element the owning node * @param source the input source which contains the CSS stylesheet which this stylesheet host object represents * @param uri this stylesheet's URI (used to resolved contained @import rules) */ public Stylesheet(final HTMLElement element, final InputSource source, final String uri) { if (source.getURI()==null) source.setURI(uri); setParentScope(element.getWindow()); setPrototype(getPrototype(Stylesheet.class)); wrapped_ = parseCSS(source); uri_ = uri; ownerNode_ = element; }
tempStream.setURI(url.toString()); tempStream.setByteStream(stream); parseImport = true;
InputSource source = new InputSource(); source.setByteStream(stream); source.setURI(url.toString()); engine.parseStyleSheet(source); } catch (IOException e) {
final String styleAttribute = jsElement_.getDomNodeOrDie().getAttribute("style"); final InputSource source = new InputSource(new StringReader(styleAttribute)); source.setURI(uri); final ErrorHandler errorHandler = getWindow().getWebWindow().getWebClient().getCssErrorHandler(); final CSSOMParser parser = new CSSOMParser(new SACParserCSS21());
final String styleAttribute = jsElement_.getDomNodeOrDie().getAttribute("style"); final InputSource source = new InputSource(new StringReader(styleAttribute)); source.setURI(uri); final ErrorHandler errorHandler = getWindow().getWebWindow().getWebClient().getCssErrorHandler(); final CSSOMParser parser = new CSSOMParser(new SACParserCSS21());
final String styleAttribute = jsElement_.getDomNodeOrDie().getAttribute("style"); final InputSource source = new InputSource(new StringReader(styleAttribute)); source.setURI(uri); final ErrorHandler errorHandler = getWindow().getWebWindow().getWebClient().getCssErrorHandler(); final CSSOMParser parser = new CSSOMParser(new SACParserCSS21());
InputSource source = new InputSource(); source.setByteStream(stream); source.setURI(url.toString()); engine.parseStyleSheet(source); } catch (IOException e) {
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(); }