本文整理匯總了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;
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
}
示例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;
}
}
示例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();
}
示例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);
}
示例12: ToSAXHandler
import org.xml.sax.ext.LexicalHandler; //導入依賴的package包/類
public ToSAXHandler(
ContentHandler hdlr,
LexicalHandler lex,
String encoding)
{
setContentHandler(hdlr);
setLexHandler(lex);
setEncoding(encoding);
}
示例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);
}
}
示例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);
}
}
示例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;
}
}