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


Java Parser类代码示例

本文整理汇总了Java中org.w3c.css.sac.Parser的典型用法代码示例。如果您正苦于以下问题:Java Parser类的具体用法?Java Parser怎么用?Java Parser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: makeParser

import org.w3c.css.sac.Parser; //导入依赖的package包/类
@Override
public Parser makeParser(String name) throws ClassNotFoundException, IllegalAccessException, InstantiationException,
NullPointerException, ClassCastException {
	String classNameParser = parsers.get(name);
	if (classNameParser != null) {
		Class<?> classParser = super.getClass().getClassLoader().loadClass(classNameParser);
		return (Parser) classParser.newInstance();
	}
	throw new IllegalAccessException("SAC parser with name=" + name
			+ " was not registered into SAC parser factory.");
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:12,代码来源:SACParserFactoryImpl.java

示例2: CSSParser

import org.w3c.css.sac.Parser; //导入依赖的package包/类
public CSSParser(InputSource source, Parser parser) throws CSSException, IOException {
	this.handler = new CSSDocumentHandler();
	parser.setDocumentHandler(handler);
	parser.setConditionFactory(CSSConditionFactory.INSTANCE);
	parser.setSelectorFactory(CSSSelectorFactory.INSTANCE);
	parser.parseStyleSheet(source);
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:8,代码来源:CSSParser.java

示例3: makeParser

import org.w3c.css.sac.Parser; //导入依赖的package包/类
/**
 * Return default instance of SAC Parser. If preferredParserName is filled,
 * it return the instance of SAC Parser registered with this name, otherwise
 * this method search the SAC Parser class name to instanciate into System
 * property with key org.w3c.css.sac.parser.
 */
@Override
public Parser makeParser() throws ClassNotFoundException, IllegalAccessException, InstantiationException,
		NullPointerException, ClassCastException {
	try {
		if (preferredParserName != null)
			return makeParser(preferredParserName);
	} catch (Throwable e) {
		e.printStackTrace();
	}
	return super.makeParser();
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:18,代码来源:SACParserFactory.java

示例4: CSSOMParser

import org.w3c.css.sac.Parser; //导入依赖的package包/类
/**
 * Creates new CSSOMParser.
 *
 * @param parser
 *            the SAC Parser
 */
public CSSOMParser(final Parser parser) {
	synchronized (LOCK) {
		if (null != parser) {
			System.setProperty("org.w3c.css.sac.parser", parser.getClass().getCanonicalName());
			parser_ = parser;
			return;
		}

		// no parser provided, determine the correct one
		String currentParser = System.getProperty("org.w3c.css.sac.parser");
		try {
			// use the direct method if we already failed once before
			if (null != LastFailed_ && LastFailed_.equals(currentParser)) {
				parser_ = new SACParserCSS21();
			} else {
				if (null == currentParser) {
					System.setProperty("org.w3c.css.sac.parser", DEFAULT_PARSER);
					currentParser = DEFAULT_PARSER;
				}
				final ParserFactory factory = new ParserFactory();
				parser_ = factory.makeParser();
			}
		} catch (final Exception e) {
			logger.warn(e.toString());
			logger.warn("using the default 'SACParserCSS21' instead");
			logger.warn("CSSOMParser", "consturctor", e);
			LastFailed_ = currentParser;
			parser_ = new SACParserCSS21();
		}
	}
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:38,代码来源:CSSOMParser.java

示例5: CSSEngine

import org.w3c.css.sac.Parser; //导入依赖的package包/类
/**
    * Creates a new CSSEngine.
    * @param p The css parser.
    * @param pm The property value managers.
    * @param ctx The CSS context.
    */
   protected CSSEngine( Parser p, PropertyManagerFactory pm, CSSContext ctx )
{
	this.parser = p;
	this.cssContext = ctx;
	this.pm = pm;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:13,代码来源:CSSEngine.java

示例6: ExtendedParserWrapper

import org.w3c.css.sac.Parser; //导入依赖的package包/类
public ExtendedParserWrapper(Parser parser) {
    this.parser = parser;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:4,代码来源:ExtendedParserWrapper.java

示例7: getParser

import org.w3c.css.sac.Parser; //导入依赖的package包/类
public Parser getParser()
{
	return parser;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:5,代码来源:CSSEngine.java

示例8: wrap

import org.w3c.css.sac.Parser; //导入依赖的package包/类
/**
 * This converts a standard @link org.w3c.css.sac.Parser into
 * an Extended Parser.  If it is already an ExtendedParser
 * it will simply cast it and return, otherwise it will wrap it
 * and return the result.
 * @param p Parser to wrap.
 * @return p as an ExtendedParser.
 */
public static ExtendedParser wrap(Parser p) {
    if (p instanceof ExtendedParser)
        return (ExtendedParser)p;

    return new ExtendedParserWrapper(p);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:15,代码来源:ExtendedParserWrapper.java

示例9: makeParser

import org.w3c.css.sac.Parser; //导入依赖的package包/类
/**
 * Create a parser with given selectors factory and conditions factory.
 *
 * @return the parser
 * @throws ClassNotFoundException
 *             the class not found exception
 * @throws IllegalAccessException
 *             the illegal access exception
 * @throws InstantiationException
 *             the instantiation exception
 * @throws NullPointerException
 *             the null pointer exception
 * @throws ClassCastException
 *             the class cast exception
 */
public Parser makeParser() throws ClassNotFoundException, IllegalAccessException, InstantiationException,
		NullPointerException, ClassCastException {
	String className = System.getProperty("org.w3c.css.sac.parser");
	if (className == null) {
		throw new NullPointerException("No value for sac.parser property");
	} else {
		return (Parser) Class.forName(className).newInstance();
	}
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:25,代码来源:ParserFactory.java

示例10: makeParser

import org.w3c.css.sac.Parser; //导入依赖的package包/类
/**
 * Return default instance of SAC Parser. If preferredParserName is filled,
 * it return the instance of SAC Parser registered with this name, otherwise
 * this method search teh SAC Parser class name to instanciate into System
 * property with key org.w3c.css.sac.parser.
 */
public Parser makeParser() throws ClassNotFoundException,
		IllegalAccessException, InstantiationException,
		NullPointerException, ClassCastException;
 
开发者ID:eclipse,项目名称:tm4e,代码行数:10,代码来源:ISACParserFactory.java


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