當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。