当前位置: 首页>>代码示例>>Java>>正文


Java CSSFactory.parse方法代码示例

本文整理汇总了Java中cz.vutbr.web.css.CSSFactory.parse方法的典型用法代码示例。如果您正苦于以下问题:Java CSSFactory.parse方法的具体用法?Java CSSFactory.parse怎么用?Java CSSFactory.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cz.vutbr.web.css.CSSFactory的用法示例。


在下文中一共展示了CSSFactory.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@BeforeClass
public static void init() throws IOException, CSSException, SAXException {
	log.info("\n\n\n == AnalyzerTest test at {} == \n\n\n", new Date());

       DOMSource ds = new DOMSource(AnalyzerTest.class.getResourceAsStream("/simple/data.html"));
       doc = ds.parse();
       
	sheet = CSSFactory.parse(AnalyzerTest.class.getResource("/simple/data.css"), null);

	analyzer = new Analyzer(sheet);

	NodeList list = doc.getElementsByTagName("body");
	assertEquals("There is one <body> element", 1, list.getLength());

	//walker = new TidyTreeWalker(list.item(0), NodeFilter.SHOW_ELEMENT);
	DocumentTraversal traversal = (DocumentTraversal) doc;
	walker = traversal.createTreeWalker(list.item(0), NodeFilter.SHOW_ELEMENT, null, false);
	elements = new ElementMap(doc);
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:20,代码来源:AnalyzerTest.java

示例2: parse

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
static StyleSheet parse(final String css) {
  try {
    return CSSFactory.parse(css);
  } catch (IOException | CSSException e) {
    throw new DOMException(DOMException.SYNTAX_ERR, "");
  }
}
 
开发者ID:UprootLabs,项目名称:jStyleDomBridge,代码行数:8,代码来源:CSSUtils.java

示例3: testMediaImport

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test
public void testMediaImport() throws CSSException, IOException {
       CSSFactory.setAutoImportMedia(new MediaSpecAll()); //reset to default
	StyleSheet ss = CSSFactory.parse(getClass().getResource("/simple/impmedia.css"), null);
	assertEquals("All rules have been imported", 8, ss.size());
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:7,代码来源:ImportTest1.java

示例4: testMediaImportLimit1

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test
public void testMediaImportLimit1() throws CSSException, IOException {
    CSSFactory.setAutoImportMedia(new MediaSpec("projection"));
    StyleSheet ss = CSSFactory.parse(getClass().getResource("/simple/impmedia.css"), null);
    assertEquals("All rules have been imported", 8, ss.size());
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:7,代码来源:ImportTest1.java

示例5: testMediaImportLimit2

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test
public void testMediaImportLimit2() throws CSSException, IOException {
    CSSFactory.setAutoImportMedia(new MediaSpec("screen"));
    StyleSheet ss = CSSFactory.parse(getClass().getResource("/simple/impmedia.css"), null);
    assertEquals("No rules have been imported", 0, ss.size());
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:7,代码来源:ImportTest1.java

示例6: testMediaImportLimit3

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test
public void testMediaImportLimit3() throws CSSException, IOException {
    CSSFactory.setAutoImportMedia(new MediaSpecNone());
    StyleSheet ss = CSSFactory.parse(getClass().getResource("/simple/impmedia.css"), null);
    assertEquals("No rules have been imported", 0, ss.size());
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:7,代码来源:ImportTest1.java

示例7: testRealAndNested

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test
public void testRealAndNested() throws CSSException, IOException {
	CSSFactory.parse(getClass().getResource("/abclinuxu/styles.css"), null);
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:5,代码来源:ImportTest1.java

示例8: testExternAndNested

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test
public void testExternAndNested() throws CSSException, IOException {
	CSSFactory.parse(new URL("http://www.abclinuxu.cz/styles.css"), null);
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:5,代码来源:ImportTest1.java

示例9: testImportEscaped

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test
public void testImportEscaped() throws CSSException,IOException{
	StyleSheet ss = CSSFactory.parse(getClass().getResource("/simple/imp_escaped.css"), null);
	this.checkDataCSS(ss);
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:6,代码来源:ImportTest1.java

示例10: testString1

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test 
public void testString1() throws IOException, CSSException   {
    
    URL url = getClass().getResource("/simple/charset1.css");
    StyleSheet ss = CSSFactory.parse(url, "utf-8");
    
    assertEquals("One rule is set", 1, ss.size());
    
    RuleSet rule = (RuleSet) ss.get(0);             
    
    assertArrayEquals("Rule contains one selector BODY ", 
            SelectorsUtil.createSelectors("tést"), 
            rule.getSelectors());
    
    assertEquals("Rule contains one declaration", rule.size(), 1);
                        
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:18,代码来源:CharsetTest.java

示例11: init

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@BeforeClass
public static void init() throws IOException, CSSException, SAXException {

	log.info("\n\n\n == AdvancedTest test at {} == \n\n\n", new Date());

       DOMSource ds = new DOMSource(AdvancedCSSTest.class.getResourceAsStream("/advanced/style.html"));
       doc = ds.parse();

	sheet = CSSFactory.parse(AdvancedCSSTest.class.getResource("/advanced/style.css"), null);

	analyzer = new Analyzer(sheet);
	decl = analyzer.evaluateDOM(doc, "all", true);

	elements = new ElementMap(doc);
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:16,代码来源:AdvancedCSSTest.java

示例12: testSimpleImport

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test
public void testSimpleImport() throws CSSException, IOException {

	StyleSheet ss = CSSFactory.parse(getClass().getResource("/simple/imp.css"), null);
    this.checkDataCSS(ss);

}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:8,代码来源:ImportTest1.java

示例13: init

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@BeforeClass
public static void init() throws CSSException, IOException, SAXException {
	log.info("\n\n\n == UAConformancy test at {} == \n\n\n", new Date());

       DOMSource ds = new DOMSource(UAConformancyTest.class.getResourceAsStream("/invalid/style.html"));
       Document doc = ds.parse();

	em = new ElementMap(doc);

	StyleSheet sheet = CSSFactory.parse(UAConformancyTest.class.getResource("/invalid/style.css"), null);

	Analyzer analyzer = new Analyzer(sheet);
	decl = analyzer.evaluateDOM(doc, "screen", true);

}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:16,代码来源:UAConformancyTest.java

示例14: init

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@BeforeClass
public static void init() throws CSSException, IOException, SAXException {
	
	log.info("\n\n\n == NodeDataVariant test at {} == \n\n\n", new Date());
	
       DOMSource ds = new DOMSource(new FileInputStream("data/simple/data.html"));
       doc = ds.parse();
       
	StyleSheet style = CSSFactory.parse("data/simple/data.css", null);

	analyzer = new Analyzer(style);
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:13,代码来源:NodeDataVariantTest.java

示例15: main

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        Date start = new Date();
		StyleSheet sheet = CSSFactory.parse("src/test/resources/profiling/slate.css", "UTF-8");

		System.out.println("Total rules: " + sheet.size());
        Date end = new Date();
        System.out.println("Parsing time: " + (end.getTime() - start.getTime()) + " ms");

	}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:11,代码来源:ProfilerEntryPoint.java


注:本文中的cz.vutbr.web.css.CSSFactory.parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。