| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.xml.sax.helpers.XMLReaderAdapter
public class XMLReaderAdapter
将 SAX2 XMLReader 适配为 SAX1 解析器。
此模块(包括源代码和文档)位于公共域中,对该模块不提供担保。有关更多信息,请参阅http://www.saxproject.org。
此类包装 SAX2 XMLReader 并且使之充当 SAX1 Parser。XMLReader 必须支持 http://xml.org/sax/features/namespace-prefixes 属性的 true 值,否则解析将会失败,并抛出 SAXException;如果 XMLReader 支持 http://xml.org/sax/features/namespaces 属性的 false 值,这也将会被用于提高效率。
Parser, 
XMLReader| 构造方法摘要 | |
|---|---|
| XMLReaderAdapter()创建一个新的适配器。 | |
| XMLReaderAdapter(XMLReader xmlReader)创建一个新的适配器。 | |
| 方法摘要 | |
|---|---|
|  void | characters(char[] ch,
           int start,
           int length)适配 SAX2 字符事件。 | 
|  void | endDocument()结束文档事件。 | 
|  void | endElement(String uri,
           String localName,
           String qName)适配 SAX2 结束元素事件。 | 
|  void | endPrefixMapping(String prefix)适配 SAX2 结束前缀映射事件。 | 
|  void | ignorableWhitespace(char[] ch,
                    int start,
                    int length)适配 SAX2 忽略空白事件。 | 
|  void | parse(InputSource input)解析文档。 | 
|  void | parse(String systemId)解析文档。 | 
|  void | processingInstruction(String target,
                      String data)适配 SAX2 处理指令事件。 | 
|  void | setDocumentHandler(DocumentHandler handler)注册 SAX1 文档事件处理程序。 | 
|  void | setDocumentLocator(Locator locator)设置文档定位器。 | 
|  void | setDTDHandler(DTDHandler handler)注册 DTD 事件处理程序。 | 
|  void | setEntityResolver(EntityResolver resolver)注册实体解析器。 | 
|  void | setErrorHandler(ErrorHandler handler)注册错误事件处理程序。 | 
|  void | setLocale(Locale locale)设置错误报告的语言环境。 | 
|  void | skippedEntity(String name)适配 SAX2 跳过的实体事件。 | 
|  void | startDocument()开始文档事件。 | 
|  void | startElement(String uri,
             String localName,
             String qName,
             Attributes atts)适配 SAX2 开始元素事件。 | 
|  void | startPrefixMapping(String prefix,
                   String uri)适配 SAX2 开始前缀映射事件。 | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| 构造方法详细信息 | 
|---|
public XMLReaderAdapter()
                 throws SAXException
使用 "org.xml.sax.driver" 属性来查找要嵌入的 SAX2 驱动程序。
SAXException - 如果无法实例化嵌入的驱动程序,或者未指定 org.xml.sax.driver 属性。public XMLReaderAdapter(XMLReader xmlReader)
创建一个新的适配器,包装 SAX2 XMLReader。适配器将使 XMLReader 的作用与 SAX1 解析器类似。
xmlReader - 要包装的 SAX2 XMLReader。
NullPointerException - 如果参数为 null。| 方法详细信息 | 
|---|
public void setLocale(Locale locale)
               throws SAXException
SAX2 中不支持这么做,并且总是抛出异常。
Parser 中的 setLocalelocale - 错误报告的语言环境。
SAXException - 如果不重写则抛出该异常。Parser.setLocale(java.util.Locale)public void setEntityResolver(EntityResolver resolver)
Parser 中的 setEntityResolverresolver - 新的解析器。Parser.setEntityResolver(org.xml.sax.EntityResolver)public void setDTDHandler(DTDHandler handler)
Parser 中的 setDTDHandlerhandler - 新的 DTD 事件处理程序。Parser.setDTDHandler(org.xml.sax.DTDHandler)public void setDocumentHandler(DocumentHandler handler)
注意,SAX1 文档处理程序不支持名称空间。
Parser 中的 setDocumentHandlerhandler - 新的 SAX1 文档事件处理程序。Parser.setDocumentHandler(org.xml.sax.DocumentHandler)public void setErrorHandler(ErrorHandler handler)
Parser 中的 setErrorHandlerhandler - 新的错误事件处理程序。Parser.setErrorHandler(org.xml.sax.ErrorHandler)
public void parse(String systemId)
           throws IOException,
                  SAXException
如果嵌入的 XMLReader 不支持 http://xml.org/sax/features/namespace-prefixes 属性,此方法将抛出异常。
Parser 中的 parsesystemId - 文档的绝对 URL。
IOException - 如果在读取文档的原始内容时存在问题。
SAXException - 如果在处理文档时存在问题。parse(org.xml.sax.InputSource), 
Parser.parse(java.lang.String)
public void parse(InputSource input)
           throws IOException,
                  SAXException
如果嵌入的 XMLReader 不支持 http://xml.org/sax/features/namespace-prefixes 属性,此方法将抛出异常。
Parser 中的 parseinput - 文档的输入源。
IOException - 如果在读取文档的原始内容时存在问题。
SAXException - 如果在处理文档时存在问题。parse(java.lang.String), 
Parser.parse(org.xml.sax.InputSource)public void setDocumentLocator(Locator locator)
ContentHandler 中的 setDocumentLocatorlocator - 文档定位器。ContentHandler.setDocumentLocator(org.xml.sax.Locator)
public void startDocument()
                   throws SAXException
ContentHandler 中的 startDocumentSAXException - 客户端可能引发一个处理异常。ContentHandler.startDocument()
public void endDocument()
                 throws SAXException
ContentHandler 中的 endDocumentSAXException - 客户端可能引发一个处理异常。ContentHandler.endDocument()
public void startPrefixMapping(String prefix,
                               String uri)
ContentHandler 中的 startPrefixMappingprefix - 映射的前缀。uri - 要映射到的名称空间 URI。ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)public void endPrefixMapping(String prefix)
ContentHandler 中的 endPrefixMappingprefix - 映射的前缀。ContentHandler.endPrefixMapping(java.lang.String)
public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
ContentHandler 中的 startElementuri - 名称空间 URI。localName - 名称空间本地名称。qName - 限定的(前缀)名称。atts - SAX2 属性。
SAXException - 客户端可能引发一个处理异常。ContentHandler.endDocument()
public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
ContentHandler 中的 endElementuri - 名称空间 URI。localName - 名称空间本地名称。qName - 限定的(前缀)名称。
SAXException - 客户端可能引发一个处理异常。ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
ContentHandler 中的 charactersch - 字符数组。start - 数组中的开始位置。length - 要使用的字符数。
SAXException - 客户端可能引发一个处理异常。ContentHandler.characters(char[], int, int)
public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
ContentHandler 中的 ignorableWhitespacech - 字符数组。start - 数组中的开始位置。length - 要使用的字符数。
SAXException - 客户端可能引发一个处理异常。ContentHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(String target,
                                  String data)
                           throws SAXException
ContentHandler 中的 processingInstructiontarget - 处理指令目标。data - 处理指令的剩余部分
SAXException - 客户端可能引发处理异常。ContentHandler.processingInstruction(java.lang.String, java.lang.String)
public void skippedEntity(String name)
                   throws SAXException
ContentHandler 中的 skippedEntityname - 跳过的实体的名称。
SAXException - 可由子类抛出。ContentHandler.skippedEntity(java.lang.String)| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。