本文整理汇总了Java中jdk.internal.org.xml.sax.XMLReader类的典型用法代码示例。如果您正苦于以下问题:Java XMLReader类的具体用法?Java XMLReader怎么用?Java XMLReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XMLReader类属于jdk.internal.org.xml.sax包,在下文中一共展示了XMLReader类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import jdk.internal.org.xml.sax.XMLReader; //导入依赖的package包/类
/**
* Parse the content given {@link org.xml.sax.InputSource}
* as XML using the specified
* {@link org.xml.sax.helpers.DefaultHandler}.
*
* @param is The InputSource containing the content to be parsed.
* @param dh The SAX DefaultHandler to use.
*
* @throws IllegalArgumentException If the <code>InputSource</code> object
* is <code>null</code>.
* @throws IOException If any IO errors occur.
* @throws SAXException If any SAX errors occur during processing.
*
* @see org.xml.sax.DocumentHandler
*/
public void parse(InputSource is, DefaultHandler dh)
throws SAXException, IOException
{
if (is == null) {
throw new IllegalArgumentException("InputSource cannot be null");
}
XMLReader reader = this.getXMLReader();
if (dh != null) {
reader.setContentHandler(dh);
reader.setEntityResolver(dh);
reader.setErrorHandler(dh);
reader.setDTDHandler(dh);
}
reader.parse(is);
}
示例2: getXMLReader
import jdk.internal.org.xml.sax.XMLReader; //导入依赖的package包/类
/**
* Returns the {@link org.xml.sax.XMLReader} that is encapsulated by the
* implementation of this class.
*
* @return The XMLReader that is encapsulated by the
* implementation of this class.
*
* @throws SAXException If any SAX errors occur during processing.
*/
public abstract XMLReader getXMLReader() throws SAXException;
示例3: getXMLReader
import jdk.internal.org.xml.sax.XMLReader; //导入依赖的package包/类
/**
* Returns the {@link org.xml.sax.XMLReader} that is encapsulated by the
* implementation of this class.
*
* @return The XMLReader that is encapsulated by the
* implementation of this class.
*
* @throws SAXException If any SAX errors occur during processing.
*/
public XMLReader getXMLReader()
throws SAXException {
return parser;
}