private <T extends CssNode & HasNodes> void parseInnerStylesheet( String tagName, T parent, String blockContents) { pushParent(parent); // parse the inner text InputSource s = new InputSource(); s.setCharacterStream(new StringReader(blockContents)); Parser parser = new Parser(); parser.setDocumentHandler(this); parser.setErrorHandler(errors); try { parser.parseStyleSheet(s); } catch (IOException e) { throw new CSSException(CSSException.SAC_SYNTAX_ERR, "Unable to parse " + tagName, e); } if (currentParent.pop() != parent) { // This is a coding error throw new RuntimeException("Incorrect element popped"); } }
s.setCharacterStream(new StringReader(value)); Parser parser = new Parser(); parser.setErrorHandler(errors);
void parseSprite(String atRule) throws CSSException { CssSprite sprite = new CssSprite(); currentRule = sprite; addNode(sprite); // Flag to tell startSelector() to use the CssSprite instead of creating // its own CssRule. nextSelectorCreatesRule = false; // parse the inner text InputSource s = new InputSource(); s.setCharacterStream(new StringReader(atRule.substring(7))); Parser parser = new Parser(); parser.setDocumentHandler(this); parser.setErrorHandler(errors); try { parser.parseRule(s); } catch (IOException e) { throw new CSSException(CSSException.SAC_SYNTAX_ERR, "Unable to parse @sprite", e); } }
/** * Create a new input source with a character stream. * * <p>Application writers may use setURI() to provide a base * for resolving relative URIs, and setPublicId to include a * public identifier.</p> * * <p>The character stream shall not include a byte order mark.</p> * * @see #setURI * @see #setByteStream * @see #setCharacterStream */ public InputSource(Reader characterStream) { setCharacterStream(characterStream); }
/** * Create a new input source with a character stream. * * <p>Application writers may use setURI() to provide a base * for resolving relative URIs, and setPublicId to include a * public identifier.</p> * * <p>The character stream shall not include a byte order mark.</p> * * @see #setURI * @see #setByteStream * @see #setCharacterStream */ public InputSource(Reader characterStream) { setCharacterStream(characterStream); }
public CSSStyleDeclaration parseStyleDeclaration(Reader reader) throws IOException { InputSource source = new InputSource(); source.setCharacterStream(reader); return parseStyleDeclaration(source); }
public StyleSheet parseStyleSheet(Reader reader) throws IOException { InputSource source = new InputSource(); source.setCharacterStream(reader); return parseStyleSheet(source); }
public SelectorList parseSelectors(Reader reader) throws IOException { InputSource source = new InputSource(); source.setCharacterStream(reader); return parseSelectors(source); }
public CSSValue parsePropertyValue(Reader reader) throws IOException { InputSource source = new InputSource(); source.setCharacterStream(reader); return parsePropertyValue(source); }
private <T extends CssNode & HasNodes> void parseInnerStylesheet( String tagName, T parent, String blockContents) { pushParent(parent); // parse the inner text InputSource s = new InputSource(); s.setCharacterStream(new StringReader(blockContents)); Parser parser = new Parser(); parser.setDocumentHandler(this); parser.setErrorHandler(errors); try { parser.parseStyleSheet(s); } catch (IOException e) { throw new CSSException(CSSException.SAC_SYNTAX_ERR, "Unable to parse " + tagName, e); } if (currentParent.pop() != parent) { // This is a coding error throw new RuntimeException("Incorrect element popped"); } }
private <T extends CssNode & HasNodes> void parseInnerStylesheet( String tagName, T parent, String blockContents) { pushParent(parent); // parse the inner text InputSource s = new InputSource(); s.setCharacterStream(new StringReader(blockContents)); Parser parser = new Parser(); parser.setDocumentHandler(this); parser.setErrorHandler(errors); try { parser.parseStyleSheet(s); } catch (IOException e) { throw new CSSException(CSSException.SAC_SYNTAX_ERR, "Unable to parse " + tagName, e); } if (currentParent.pop() != parent) { // This is a coding error throw new RuntimeException("Incorrect element popped"); } }
s.setCharacterStream(new StringReader(value)); Parser parser = new Parser(); parser.setErrorHandler(errors);
s.setCharacterStream(new StringReader(value)); Parser parser = new Parser(); parser.setErrorHandler(errors);
void parseSprite(String atRule) throws CSSException { CssSprite sprite = new CssSprite(); currentRule = sprite; addNode(sprite); // Flag to tell startSelector() to use the CssSprite instead of creating // its own CssRule. nextSelectorCreatesRule = false; // parse the inner text InputSource s = new InputSource(); s.setCharacterStream(new StringReader(atRule.substring(7))); Parser parser = new Parser(); parser.setDocumentHandler(this); parser.setErrorHandler(errors); try { parser.parseRule(s); } catch (IOException e) { throw new CSSException(CSSException.SAC_SYNTAX_ERR, "Unable to parse @sprite", e); } }
void parseSprite(String atRule) throws CSSException { CssSprite sprite = new CssSprite(); currentRule = sprite; addNode(sprite); // Flag to tell startSelector() to use the CssSprite instead of creating // its own CssRule. nextSelectorCreatesRule = false; // parse the inner text InputSource s = new InputSource(); s.setCharacterStream(new StringReader(atRule.substring(7))); Parser parser = new Parser(); parser.setDocumentHandler(this); parser.setErrorHandler(errors); try { parser.parseRule(s); } catch (IOException e) { throw new CSSException(CSSException.SAC_SYNTAX_ERR, "Unable to parse @sprite", e); } }
source.setCharacterStream(new InputStreamReader(source.getByteStream(), Encoding.getJavaEncoding(encoding)));
source.setCharacterStream( new InputStreamReader( source.getByteStream(), Encoding.getJavaEncoding( encoding ) ) );
source.setCharacterStream( new StringReader( value ) );
source.setCharacterStream( new StringReader( styleText ) );
source.setCharacterStream( new StringReader( value ) );