Package org.w3c.dom.css

Examples of org.w3c.dom.css.CSSStyleSheet


    /**
     * Returns the user-agent stylesheet.
     */
    public CSSStyleSheet getUserAgentStyleSheet() {
        CSSStyleSheet result = null;

        URL url = getClass().getResource("resources/UserAgentStyleSheet.css");
        if (url != null) {
            String uri = url.toString();
            result = createCSSStyleSheet("User Agent Style Sheet", "all");
View Full Code Here


    /**
     * Returns the user-agent stylesheet.
     */
    public CSSStyleSheet getUserAgentStyleSheet() {
        CSSStyleSheet result = null;

        URL url = getClass().getResource("resources/UserAgentStyleSheet.css");
        if (url != null) {
            String uri = url.toString();
            result = createCSSStyleSheet("User Agent Style Sheet", "all");
View Full Code Here

  public CStyler(StyleSheetList cssList) {
    for (int i = 0; i < cssList.getLength(); i++) {
      Object stylesheet = cssList.item(i);

      if (stylesheet instanceof CSSStyleSheet) {
        CSSStyleSheet css = (CSSStyleSheet) stylesheet;
        parseSelectors(css,styles);
      } // end if
    } // end for
  }
View Full Code Here

            result.add(new CStyle(element,decl));
          }
        }
      } // end if
      else if (rule.getType() == CSSRule.IMPORT_RULE) {
        CSSStyleSheet importCSS = ((CSSImportRule) rule).getStyleSheet();
        parseSelectors(importCSS,result);
      } // end else if
    }
  }
View Full Code Here

          while ((iNbByteRead = in.read(buffer)) != -1) {
            bOut.write(buffer, 0, iNbByteRead);
          } // end while

          String document = new String(bOut.toByteArray(), "utf-8");
          CSSStyleSheet sheet = CCSSParser.parse(document, null,
              null, href);

          if (sheet != null) {
            cssList.add(sheet);
          }
        } // end try
        catch (final Exception ignore) {
          System.err.println("WARNING: could not load CSS : " + href);
        } // end catch
      } // end if
    } // end for
    nl = this.getElementsByTagName("style");

    StringBuffer sbuffer = new StringBuffer();

    for (int i = 0; i < nl.getLength(); i++) {
      Element style = (Element) nl.item(i);
      NodeList c = style.getChildNodes();

      for (int j = 0; j < c.getLength(); j++) {
        Node node = c.item(j);

        if ((node.getNodeType() == Node.TEXT_NODE)
            || (node.getNodeType() == Node.CDATA_SECTION_NODE)
            || (node.getNodeType() == Node.COMMENT_NODE)
            || (node.getNodeType() == Node.ENTITY_REFERENCE_NODE)) {
          sbuffer.append(node.toString());
        } // end if
      } // end for
    } // end for

    try {
      String document = sbuffer.toString();
      CSSStyleSheet sheet = CCSSParser.parse(document, null, null, this
          .getDocumentURI());

      if (sheet != null) {
        cssList.add(sheet);
      }
View Full Code Here

  }
 
  AttributeRuleList getRuleList(InputStream stream) throws IOException {
    InputSource source = new InputSource(new InputStreamReader(stream));
        CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
        CSSStyleSheet stylesheet = parser.parseStyleSheet(source, null, null);
        CSSRuleList ruleList = stylesheet.getCssRules();
       
        return new AttributeRuleList(ruleList);
  }
View Full Code Here

TOP

Related Classes of org.w3c.dom.css.CSSStyleSheet

Copyright © 2018 www.massapicom. 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.