Package org.w3c.css.sac

Examples of org.w3c.css.sac.Parser.parseStyleSheet()


      parser.setErrorHandler(handler);

      final InputStream stream = data.getResourceAsStream(manager);
      final InputSource inputSource = new InputSource();
      inputSource.setByteStream(stream);
      parser.parseStyleSheet(inputSource);

      final DependencyCollector dependencies = handler.getDependencies();
      if (context != null)
      {
        dependencies.add(data.getKey(), data.getVersion(manager));
View Full Code Here


      Parser parser = ss.getParser();
      InputSource is = new InputSource(uri);
      parser.setSelectorFactory(AbstractCSSRule.SELECTOR_FACTORY);
      parser.setConditionFactory(AbstractCSSRule.CONDITION_FACTORY);
      parser.setDocumentHandler(new CSSDocumentHandler(ss, uri, true));
      parser.parseStyleSheet(is);
  } catch (Exception e) {
            e.printStackTrace();
            String m = e.getMessage();
      throw CSSDOMExceptionFactory.createDOMException
    (DOMException.SYNTAX_ERR,
View Full Code Here

  try {
      Parser parser = ss.getParser();
      parser.setSelectorFactory(AbstractCSSRule.SELECTOR_FACTORY);
      parser.setConditionFactory(AbstractCSSRule.CONDITION_FACTORY);
      parser.setDocumentHandler(new CSSDocumentHandler(ss, null, true));
      parser.parseStyleSheet(new InputSource(new StringReader(rules)));
  } catch (DOMException e) {
      throw CSSDOMExceptionFactory.createDOMException
    (DOMException.SYNTAX_ERR,
     "rules.syntax.error",
     new Object[] { rules + "\n" + e.getMessage() });
View Full Code Here

      parser.setErrorHandler(handler);

      final InputStream stream = data.getResourceAsStream(manager);
      final InputSource inputSource = new InputSource();
      inputSource.setByteStream(stream);
      parser.parseStyleSheet(inputSource);

      final DependencyCollector dependencies = handler.getDependencies();
      if (context != null)
      {
        dependencies.add(data.getKey(), data.getVersion(manager));
View Full Code Here

      parser.setErrorHandler(handler);

      final InputStream stream = data.getResourceAsStream(manager);
      final InputSource inputSource = new InputSource();
      inputSource.setByteStream(stream);
      parser.parseStyleSheet(inputSource);

      final DependencyCollector dependencies = handler.getDependencies();
      if (context != null)
      {
        dependencies.add(data.getKey(), data.getVersion(manager));
View Full Code Here

      parser.setErrorHandler(handler);

      final InputStream stream = data.getResourceAsStream(manager);
      final InputSource inputSource = new InputSource();
      inputSource.setByteStream(stream);
      parser.parseStyleSheet(inputSource);

      final DependencyCollector dependencies = handler.getDependencies();
      if (context != null)
      {
        dependencies.add(data.getKey(), data.getVersion(manager));
View Full Code Here

         Parser parser = ParserFactory.createParser();
         StringWriter out = new StringWriter();
         SerializationDocumentHandler serializer = new SerializationDocumentHandler(out);
         OrientationFilter filter = new OrientationFilter(serializer, true);
         parser.setDocumentHandler(filter);
         parser.parseStyleSheet(new InputSource(new StringReader(ltSheet)));
         out.close();
         String actualRTSheet = out.toString();
         StylesheetObject expected = StylesheetObject.createStylesheet(expectedRTSheet);
         StylesheetObject actual = StylesheetObject.createStylesheet(actualRTSheet);
         if (!expected.equals(actual))
View Full Code Here

         //      System.out.println("leftSheet = " + leftSheet);
         Parser parser = ParserFactory.createParser();
         StringWriter out = new StringWriter();
         SerializationDocumentHandler serializer = new SerializationDocumentHandler(out);
         parser.setDocumentHandler(serializer);
         parser.parseStyleSheet(new InputSource(new StringReader(leftSheet)));
         out.close();
         String rightSheet = out.toString();
         StylesheetObject left = StylesheetObject.createStylesheet(leftSheet);
         StylesheetObject right = StylesheetObject.createStylesheet(rightSheet);
         if (!left.equals(right))
View Full Code Here

   private static StylesheetObject createStylesheet(InputSource source) throws IOException, CSSException
   {
      Parser parser = ParserFactory.createParser();
      ModelBuilder builder = new ModelBuilder();
      parser.setDocumentHandler(builder);
      parser.parseStyleSheet(source);
      return builder.getStylesheet();
   }

   private static final SACMediaList SAC_MEDIA_LIST = new SACMediaList()
   {
View Full Code Here

    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 cleanUrlForPath(String url) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.