Search in sources :

Example 1 with Parser

use of org.w3c.css.sac.Parser in project onebusaway-application-modules by camsys.

the class CssResourceImpl method parse.

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();
}
Also used : InputSource(org.w3c.css.sac.InputSource) InputStreamReader(java.io.InputStreamReader) SACParserCSS2(com.steadystate.css.parser.SACParserCSS2) Parser(org.w3c.css.sac.Parser)

Example 2 with Parser

use of org.w3c.css.sac.Parser in project onebusaway-application-modules by camsys.

the class CssDocumentHandlerImpl method parse.

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);
    }
}
Also used : InputSource(org.w3c.css.sac.InputSource) SACParserCSS2(com.steadystate.css.parser.SACParserCSS2) BufferedReader(java.io.BufferedReader) StringReader(java.io.StringReader) CSSException(org.w3c.css.sac.CSSException) IOException(java.io.IOException) Parser(org.w3c.css.sac.Parser)

Example 3 with Parser

use of org.w3c.css.sac.Parser in project onebusaway-application-modules by camsys.

the class CssResourceTransformationStrategy method parse.

/**
 ***************************************************************************
 * 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();
}
Also used : InputSource(org.w3c.css.sac.InputSource) InputStreamReader(java.io.InputStreamReader) SACParserCSS2(com.steadystate.css.parser.SACParserCSS2) Parser(org.w3c.css.sac.Parser)

Aggregations

SACParserCSS2 (com.steadystate.css.parser.SACParserCSS2)3 InputSource (org.w3c.css.sac.InputSource)3 Parser (org.w3c.css.sac.Parser)3 InputStreamReader (java.io.InputStreamReader)2 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 CSSException (org.w3c.css.sac.CSSException)1