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


Java LexicalHandler类代码示例

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


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

示例1: setResult

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
@Override
public void setResult(Result result) throws IllegalArgumentException
{
	SAXResult saxResult = toSAXResult(result);

	ContentHandler handler = saxResult.getHandler();
	this.nextContentHandler = handler;
	if (handler instanceof LexicalHandler)
	{
		this.nextLexicalHandler = (LexicalHandler) handler;
	}
	if (handler instanceof DTDHandler)
	{
		this.nextDtdHandler = (DTDHandler) handler;
	}

}
 
开发者ID:fluentxml4j,项目名称:fluentxml4j,代码行数:18,代码来源:AbstractSAXFilter.java

示例2: lexicalHandler

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
@Test
public void lexicalHandler() throws Exception {
	Resource testLexicalHandlerXml = new ClassPathResource("testLexicalHandler.xml", getClass());

	LexicalHandler expectedLexicalHandler = mockLexicalHandler();
	standardReader.setContentHandler(null);
	standardReader.setProperty("http://xml.org/sax/properties/lexical-handler", expectedLexicalHandler);
	standardReader.parse(new InputSource(testLexicalHandlerXml.getInputStream()));
	inputFactory.setProperty("javax.xml.stream.isCoalescing", Boolean.FALSE);
	inputFactory.setProperty("http://java.sun.com/xml/stream/properties/report-cdata-event", Boolean.TRUE);
	inputFactory.setProperty("javax.xml.stream.isReplacingEntityReferences", Boolean.FALSE);
	inputFactory.setProperty("javax.xml.stream.isSupportingExternalEntities", Boolean.FALSE);

	LexicalHandler actualLexicalHandler = mockLexicalHandler();
	willAnswer(new Answer<Object>() {
		@Override
		public Object answer(InvocationOnMock invocation) throws Throwable {
			return invocation.getArguments()[0] = "element";
		}
	}).given(actualLexicalHandler).startDTD(anyString(), anyString(), anyString());
	AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(testLexicalHandlerXml.getInputStream());
	staxXmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", actualLexicalHandler);
	staxXmlReader.parse(new InputSource());

	verifyIdenticalInvocations(expectedLexicalHandler, actualLexicalHandler);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:27,代码来源:AbstractStaxXMLReaderTestCase.java

示例3: setProperty

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
/**
 * <b>SAX2</b>: Assigns the specified property. Like SAX1 handlers, these may
 * be changed at any time.
 */

public void setProperty (final String propertyId, final Object property) throws SAXNotRecognizedException,
                                                                         SAXNotSupportedException
{
  if (propertyId.equals ("http://xml.org/sax/properties/lexical-handler"))
  {
    if (property instanceof LexicalHandler)
    {
      lexicalHandler = (LexicalHandler) property;
    }
    else
    {
      throw new SAXNotSupportedException ("Lexical Handler must be instance of org.xml.sax.ext.LexicalHandler");
    }
  }
  else
  {
    throw new SAXNotRecognizedException (propertyId);
  }
}
 
开发者ID:phax,项目名称:ph-stx,代码行数:25,代码来源:DOMDriver.java

示例4: setProperty

import org.xml.sax.ext.LexicalHandler; //导入依赖的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 {
        throw new SAXNotRecognizedException("Property not recognized: " + name);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:SAXBufferProcessor.java

示例5: setProperty

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

示例6: setProperty

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
@Override
public void setProperty(String name, Object value) throws SAXNotRecognizedException {
    if( "http://xml.org/sax/properties/lexical-handler".equals(name) ) {
        this.lexicalHandler = (LexicalHandler)value;
        return;
    }
    throw new SAXNotRecognizedException(name);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:StAXSource.java

示例7: SaxSerializer

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
public SaxSerializer(ContentHandler handler,LexicalHandler lex, boolean indenting) {
    if(!indenting) {
        writer = handler;
        lexical = lex;
    } else {
        IndentingXMLFilter indenter = new IndentingXMLFilter(handler, lex);
        writer = indenter;
        lexical = indenter;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:SaxSerializer.java

示例8: setProperty

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
public void setProperty(String name, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException {
    if (LEXICAL_HANDLER_PROP.equals(name)) {
        lexicalHandler = (LexicalHandler) value;
    } else {
        super.setProperty(name, value);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:RejectDoctypeSaxFilter.java

示例9: setContentHandler

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
public void setContentHandler(ContentHandler handler) throws
    NullPointerException
{
    _sax = handler;
    if (handler instanceof LexicalHandler) {
        _lex = (LexicalHandler) handler;
    }

    if (handler instanceof SAXImpl) {
        _saxImpl = (SAXImpl)handler;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:DOM2SAX.java

示例10: ToXMLSAXHandler

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
public ToXMLSAXHandler(
    ContentHandler handler,
    LexicalHandler lex,
    String encoding)
{
    super(handler, lex, encoding);

    initCDATA();
    //      initNamespaces();
    m_prefixMap = new NamespaceMappings();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:ToXMLSAXHandler.java

示例11: ToHTMLSAXHandler

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
/**
 * A constructor.
 * @param handler the wrapped SAX content handler
 * @param lex the wrapped lexical handler
 * @param encoding the encoding of the output HTML document
 */
public ToHTMLSAXHandler(
    ContentHandler handler,
    LexicalHandler lex,
    String encoding)
{
    super(handler,lex,encoding);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:ToHTMLSAXHandler.java

示例12: ToSAXHandler

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
public ToSAXHandler(
    ContentHandler hdlr,
    LexicalHandler lex,
    String encoding)
{
    setContentHandler(hdlr);
    setLexHandler(lex);
    setEncoding(encoding);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:ToSAXHandler.java

示例13: output

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
public static void output(Object e, ContentHandler ch) throws SAXException {
    if (ch instanceof LexicalHandler) {
        output(e, ch, (LexicalHandler) ch);
    } else {
        output(e, ch, null);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:XMLKit.java

示例14: setProperty

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
@Override
public void setProperty(String name, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException {
    if (LEXICAL_HANDLER_PROP.equals(name)) {
        lexicalHandler = (LexicalHandler) value;
    } else {
        super.setProperty(name, value);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:RejectDoctypeSaxFilter.java

示例15: setContentHandler

import org.xml.sax.ext.LexicalHandler; //导入依赖的package包/类
public void setContentHandler(ContentHandler handler) throws
    NullPointerException
{
    _sax = handler;
    if (handler instanceof LexicalHandler) {
        _lex = (LexicalHandler)handler;
    }

    if (handler instanceof SAXImpl) {
        _saxImpl = (SAXImpl)handler;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:DOM2SAX.java


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