• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DeclHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testProperty06

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
/**
 * Test to set and get the declaration-handler.
 *
 * @param saxparser a SAXParser instance.
 * @throws SAXException If any parse errors occur.
 */
@Test(dataProvider = "parser-provider")
public void testProperty06(SAXParser saxparser) throws SAXException {
    MyDeclHandler myDeclHandler = new MyDeclHandler();
    saxparser.setProperty(DECL_HANDLER, myDeclHandler);
    assertTrue(saxparser.getProperty(DECL_HANDLER) instanceof DeclHandler);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:SAXParserTest02.java


示例2: DocTypeTextLexicalHandler

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
public DocTypeTextLexicalHandler(DeclHandler dh) throws SAXException {
	// this.dh = dh;

	xmlReader = XMLReaderFactory.createXMLReader();

	// xmlReader.setProperty(
	// "http://xml.org/sax/properties/lexical-handler",
	// lh);

	// DTD
	xmlReader.setFeature(
			"http://xml.org/sax/features/resolve-dtd-uris", false);
	// *skip* resolving entities like DTDs
	xmlReader.setEntityResolver(new NoEntityResolver());

	xmlReader.setProperty(
			"http://xml.org/sax/properties/declaration-handler", dh);
}
 
开发者ID:EXIficient,项目名称:exificient,代码行数:19,代码来源:SAXDecoder.java


示例3: _setProperty

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
protected boolean _setProperty(String name, Object value) throws SAXNotSupportedException{
    if(LEXICAL_HANDLER.equals(name) || LEXICAL_HANDLER_ALT.equals(name)){
        if(value==null || value instanceof LexicalHandler){
            handler.setLexicalHandler((LexicalHandler)value);
            return true;
        }else
            throw new SAXNotSupportedException("value must implement "+LexicalHandler.class);
    }else if(DECL_HANDLER.equals(name) || DECL_HANDLER_ALT.equals(name)){
        if(value==null || value instanceof DeclHandler){
            handler.setDeclHandler((DeclHandler)value);
            return true;
        }else
            throw new SAXNotSupportedException("value must implement "+DeclHandler.class);
    }else
        return false;
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:17,代码来源:BaseXMLReader.java


示例4: setProperty

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
@Override
public void setProperty(String name, Object value)
    throws SAXNotRecognizedException, SAXNotSupportedException
{
    SAXProperty prop = SAXProperty.findByUri(name);
    if (prop == SAXProperty.DECLARATION_HANDLER) {
        mDeclHandler = (DeclHandler) value;
        return;
    } else if (prop == SAXProperty.DOCUMENT_XML_VERSION) {
        ; // read-only
    } else if (prop == SAXProperty.DOM_NODE) {
        ; // read-only
    } else if (prop == SAXProperty.LEXICAL_HANDLER) {
        mLexicalHandler = (LexicalHandler) value;
        return;
    } else if (prop == SAXProperty.XML_STRING) {
        ; // read-only
    } else {
        throw new SAXNotRecognizedException("Property '"+name+"' not recognized");
    }

    // Trying to modify read-only properties?
    throw new SAXNotSupportedException("Property '"+name+"' is read-only, can not be modified");
}
 
开发者ID:FasterXML,项目名称:woodstox,代码行数:25,代码来源:WstxSAXParser.java


示例5: externalEntityDecl

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
public void externalEntityDecl(String name, String publicId, String systemId)
  throws SAXException
{
  if (validatorDeclHandlers.size() > 0)
  {
    for (DeclHandler h : this.validatorDeclHandlers)
    {
      h.externalEntityDecl(name, publicId, systemId);
    }
  }

  if (context.version == EPUBVersion.VERSION_3)
  {
    report.message(MessageId.HTM_003,
        EPUBLocation.create(path, getLineNumber(), getColumnNumber(), name), name);
    return;
  }
  entities.add(name);
}
 
开发者ID:jcdarwin,项目名称:epubcheck-web,代码行数:20,代码来源:XMLParser.java


示例6: setProperty

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
/**
 * Set the property of a value on the underlying XMLReader.
 */
@Override
public void setProperty (final String prop, final Object value) throws SAXNotRecognizedException,
                                                                SAXNotSupportedException
{
  if ((PROP_PREFIX + "lexical-handler").equals (prop))
    setLexicalHandler ((LexicalHandler) value);
  else
    if ((PROP_PREFIX + "declaration-handler").equals (prop))
      setDeclHandler ((DeclHandler) value);
    else
      super.setProperty (prop, value);
}
 
开发者ID:phax,项目名称:ph-stx,代码行数:16,代码来源:Processor.java


示例7: setProperty

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
public void setProperty(String name, Object value)
  throws SAXNotRecognizedException, SAXNotSupportedException
{
  if (parser != null)
    throw new IllegalStateException("parsing in progress");
  final String FEATURES = "http://xml.org/sax/features/";
  final String PROPERTIES = "http://xml.org/sax/properties/";
  final String GNU_FEATURES = "http://gnu.org/sax/features/";
  if ((FEATURES + "namespaces").equals(name))
    namespaceAware = Boolean.TRUE.equals(value);
  else if ((FEATURES + "namespace-prefixes").equals(name))
    {
      // NOOP
    }
  else if ((FEATURES + "string-interning").equals(name))
    stringInterning = Boolean.TRUE.equals(value);
  else if ((FEATURES + "use-attributes2").equals(name))
    {
      // NOOP
    }
  else if ((FEATURES + "validation").equals(name))
    validating = Boolean.TRUE.equals(value);
  else if ((FEATURES + "external-general-entities").equals(name))
    externalEntities = Boolean.TRUE.equals(value);
  else if ((FEATURES + "external-parameter-entities").equals(name))
    externalEntities = Boolean.TRUE.equals(value);
  else if ((PROPERTIES + "declaration-handler").equals(name))
    declHandler = (DeclHandler) value;
  else if ((PROPERTIES + "lexical-handler").equals(name))
    lexicalHandler = (LexicalHandler) value;
  else if ((GNU_FEATURES + "xml-base").equals(name))
    baseAware = Boolean.TRUE.equals(value);
  else if ((GNU_FEATURES + "coalescing").equals(name))
    coalescing = Boolean.TRUE.equals(value);
  else
    throw new SAXNotSupportedException(name);
}
 
开发者ID:vilie,项目名称:javify,代码行数:38,代码来源:SAXParser.java


示例8: setProperty

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
public void setProperty (String name, Object value)
  throws SAXNotRecognizedException, SAXNotSupportedException
{
  checkPropertyName (name);
  String key = name.substring (PROPERTIES_PREFIX.length ());
  if ("declaration-handler".equals (key))
    {
      setDeclarationHandler ((DeclHandler) value);
    }
  else if ("lexical-handler".equals (key))
    {
      setLexicalHandler ((LexicalHandler) value);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:15,代码来源:GnomeXMLReader.java


示例9: setProperty

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
/**
 * <b>SAX2</b>:  Assigns the specified property.  At this time only
 * declaration and lexical handlers, and the initial DOM document, are
 * supported.  These must not be changed to values of the wrong type.
 * Like SAX1 handlers, these handlers may be changed at any time.
 * Like SAX1 input source or document URI, the initial DOM document
 * may not be changed during a parse.
 */
public void setProperty (String name, Object state)
throws SAXNotRecognizedException, SAXNotSupportedException
{
    if ((HANDLERS + "declaration-handler").equals (name)) {
        if (!(state instanceof DeclHandler || state == null))
            throw new SAXNotSupportedException (name);
        declHandler = (DeclHandler) state;
        return;
    }

    if ((HANDLERS + "lexical-handler").equals (name)) {
        if (!(state instanceof LexicalHandler || state == null))
            throw new SAXNotSupportedException (name);
        lexicalHandler = (LexicalHandler) state;
        return;
    }

    if ((HANDLERS + "dom-node").equals (name)) {
        if (state == null || state instanceof Node) {
            if (current != null)
                throw new SAXNotSupportedException (
                    "property is readonly during parse:  " + name);
            setStart ((Node) state);
            return;
        }
        throw new SAXNotSupportedException ("not a DOM Node");
    }

    // unknown properties
    throw new SAXNotRecognizedException (name);
}
 
开发者ID:vilie,项目名称:javify,代码行数:40,代码来源:DomParser.java


示例10: setProperty

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
/**
    * <b>SAX2</b>:  Assigns the specified property.  At this time only
    * declaration and lexical handlers, and the initial DOM document, are
    * supported.  These must not be changed to values of the wrong type.
    * Like SAX1 handlers, these handlers may be changed at any time.
    * Like SAX1 input source or document URI, the initial DOM document
    * may not be changed during a parse.
    */
   public void setProperty (String name, Object state)
   throws SAXNotRecognizedException, SAXNotSupportedException
   {
if ((HANDLERS + "declaration-handler").equals (name)) {
    if (!(state instanceof DeclHandler || state == null))
	throw new SAXNotSupportedException (name);
    declHandler = (DeclHandler) state;
    return;
}

if ((HANDLERS + "lexical-handler").equals (name)) {
    if (!(state instanceof LexicalHandler || state == null))
	throw new SAXNotSupportedException (name);
    lexicalHandler = (LexicalHandler) state;
    return;
}

if ((HANDLERS + "dom-node").equals (name)) {
    if (state == null || state instanceof Node) {
	if (current != null)
	    throw new SAXNotSupportedException (
		"property is readonly during parse:  " + name);
	setStart ((Node) state);
	return;
    }
    throw new SAXNotSupportedException ("not a DOM Node");
}

// unknown properties
throw new SAXNotRecognizedException (name);
   }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:40,代码来源:DomParser.java


示例11: setContentHandler

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
@Override
public void setContentHandler(ContentHandler pHandler) {
  //Called by XOM during builder construction - grab a reference to the handler so we can pass it to the decoder
  mContentHandler = pHandler;
  mDecoder.setLexicalHandler((LexicalHandler) mContentHandler);
  mDecoder.setDeclHandler((DeclHandler) mContentHandler);
}
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:8,代码来源:OracleBinaryXMLReader.java


示例12: setProperty

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
public void setProperty(String name, Object value)
		throws SAXNotRecognizedException, SAXNotSupportedException {
	if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
		this.lexicalHandler = (LexicalHandler) value;
	} else if ("http://xml.org/sax/properties/declaration-handler"
			.equals(name)) {
		this.declHandler = (DeclHandler) value;
	} else {
		throw new SAXNotRecognizedException(name);
	}
}
 
开发者ID:EXIficient,项目名称:exificient,代码行数:12,代码来源:SAXDecoder.java


示例13: setHandler

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
/**
 * Registers given handler with all its implementing interfaces.
 * This would be handy if you want to register to all interfaces
 * implemented by given handler object
 *
 * @param handler Object implementing one or more sax handler interfaces
 */
public void setHandler(Object handler){
    if(handler instanceof ContentHandler)
        setContentHandler((ContentHandler)handler);
    if(handler instanceof EntityResolver)
        setEntityResolver((EntityResolver)handler);
    if(handler instanceof ErrorHandler)
        setErrorHandler((ErrorHandler)handler);
    if(handler instanceof DTDHandler)
        setDTDHandler((DTDHandler)handler);
    if(handler instanceof LexicalHandler)
        setLexicalHandler((LexicalHandler)handler);
    if(handler instanceof DeclHandler)
        setDeclHandler((DeclHandler)handler);
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:22,代码来源:SAXDelegate.java


示例14: setProperty

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
@Override
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException{
    if(LEXICAL_HANDLER.equals(name) || LEXICAL_HANDLER_ALT.equals(name)){
        if(value==null || value instanceof LexicalHandler)
            lexicalHandler = (LexicalHandler)value;
        else
            throw new SAXNotSupportedException("value must implement "+LexicalHandler.class);
    }else if(DECL_HANDLER.equals(name) || DECL_HANDLER_ALT.equals(name)){
        if(value==null || value instanceof DeclHandler)
            declHandler = (DeclHandler)value;
        else
            throw new SAXNotSupportedException("value must implement "+DeclHandler.class);
    }else
        throw new SAXNotRecognizedException();
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:16,代码来源:AsyncXMLReader.java


示例15: addDeclHandler

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
public void addDeclHandler(DeclHandler handler)
{
  if (handler != null)
  {
    validatorDeclHandlers.add(handler);
  }
}
 
开发者ID:jcdarwin,项目名称:epubcheck-web,代码行数:8,代码来源:XMLParser.java


示例16: attributeDecl

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
public void attributeDecl(String name, String name2, String type, String mode, String value)
  throws SAXException
{
  if (validatorDeclHandlers.size() > 0)
  {
    for (DeclHandler h : this.validatorDeclHandlers)
    {
      h.attributeDecl(name, name2, type, mode, value);
    }
  }
}
 
开发者ID:jcdarwin,项目名称:epubcheck-web,代码行数:12,代码来源:XMLParser.java


示例17: elementDecl

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
public void elementDecl(String name, String model)
  throws SAXException
{
  if (validatorDeclHandlers.size() > 0)
  {
    for (DeclHandler h : this.validatorDeclHandlers)
    {
      h.elementDecl(name, model);
    }
  }
}
 
开发者ID:jcdarwin,项目名称:epubcheck-web,代码行数:12,代码来源:XMLParser.java


示例18: internalEntityDecl

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
public void internalEntityDecl(String name, String value)
  throws SAXException
{
  if (validatorDeclHandlers.size() > 0)
  {
    for (DeclHandler h : this.validatorDeclHandlers)
    {
      h.internalEntityDecl(name, value);
    }
  }
  entities.add(name);
}
 
开发者ID:jcdarwin,项目名称:epubcheck-web,代码行数:13,代码来源:XMLParser.java


示例19: setProperty

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
public void setProperty(String name, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name.equals(Properties.LEXICAL_HANDLER_PROPERTY)) {
        if (value instanceof LexicalHandler) {
            setLexicalHandler((LexicalHandler)value);
        } else {
            throw new SAXNotSupportedException(Properties.LEXICAL_HANDLER_PROPERTY);
        }
    } else if (name.equals(Properties.DTD_DECLARATION_HANDLER_PROPERTY)) {
        if (value instanceof DeclHandler) {
            setDeclHandler((DeclHandler)value);
        } else {
            throw new SAXNotSupportedException(Properties.LEXICAL_HANDLER_PROPERTY);
        }
    } else if (name.equals(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY)) {
        if (value instanceof Map) {
            setExternalVocabularies((Map)value);
        } else {
            throw new SAXNotSupportedException(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY);
        }
    } else if (name.equals(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY)) {
        if (value instanceof Map) {
            setRegisteredEncodingAlgorithms((Map)value);
        } else {
            throw new SAXNotSupportedException(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY);
        }
    } else if (name.equals(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY)) {
        if (value instanceof EncodingAlgorithmContentHandler) {
            setEncodingAlgorithmContentHandler((EncodingAlgorithmContentHandler)value);
        } else {
            throw new SAXNotSupportedException(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY);
        }
    } else if (name.equals(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY)) {
        if (value instanceof PrimitiveTypeContentHandler) {
            setPrimitiveTypeContentHandler((PrimitiveTypeContentHandler)value);
        } else {
            throw new SAXNotSupportedException(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY);
        }
    } else if (name.equals(FastInfosetReader.BUFFER_SIZE_PROPERTY)) {
        if (value instanceof Integer) {
            setBufferSize(((Integer)value).intValue());
        } else {
            throw new SAXNotSupportedException(FastInfosetReader.BUFFER_SIZE_PROPERTY);
        }
    } else {
        throw new SAXNotRecognizedException(CommonResourceBundle.getInstance().
                getString("message.propertyNotRecognized", new Object[]{name}));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:50,代码来源:SAXDocumentParser.java


示例20: setDeclHandler

import org.xml.sax.ext.DeclHandler; //导入依赖的package包/类
public void setDeclHandler(DeclHandler handler) {
    _declHandler = handler;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:SAXDocumentParser.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IDataProvider类代码示例发布时间:2022-05-21
下一篇:
Java Task类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap