📄 saxparser.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Wed Oct 31 22:26:24 PST 2001 --><TITLE>Java API for XML Processing Specification 1.1: Class SAXParser</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SAXParser.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/xml/parsers/DocumentBuilderFactory.html"><B>PREV CLASS</B></A> <A HREF="../../../javax/xml/parsers/SAXParserFactory.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="SAXParser.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.xml.parsers</FONT><BR>Class SAXParser</H2><PRE>java.lang.Object | +--<B>javax.xml.parsers.SAXParser</B></PRE><HR><DL><DT>public abstract class <B>SAXParser</B><DT>extends java.lang.Object</DL><P>Defines the API that wraps an <A HREF="../../../org/xml/sax/XMLReader.html"><CODE>XMLReader</CODE></A> implementation class. In JAXP 1.0, this class wrapped the <A HREF="../../../org/xml/sax/Parser.html"><CODE>Parser</CODE></A> interface, however this interface was replaced by the <A HREF="../../../org/xml/sax/XMLReader.html"><CODE>XMLReader</CODE></A>. For ease of transition, this class continues to support the same name and interface as well as supporting new methods. An instance of this class can be obtained from the <A HREF="../../../javax/xml/parsers/SAXParserFactory.html#newSAXParser()"><CODE>SAXParserFactory.newSAXParser()</CODE></A> method. Once an instance of this class is obtained, XML can be parsed from a variety of input sources. These input sources are InputStreams, Files, URLs, and SAX InputSources.<p> As the content is parsed by the underlying parser, methods of the given <A HREF="../../../org/xml/sax/HandlerBase.html"><CODE>HandlerBase</CODE></A> or the <A HREF="../../../org/xml/sax/helpers/DefaultHandler.html"><CODE>DefaultHandler</CODE></A> are called.<p> Implementors of this class which wrap an underlying implementation can consider using the <A HREF="../../../org/xml/sax/helpers/ParserAdapter.html"><CODE>ParserAdapter</CODE></A> class to initially adapt their SAX1 impelemntation to work under this revised class.<p> An implementation of <code>SAXParser</code> is <em>NOT</em> guaranteed to behave as per the specification if it is used concurrently by two or more threads. It is recommended to have one instance of the <code>SAXParser</code> per thread or it is upto the application to make sure about the use of <code>SAXParser</code> from more than one thread.<P><DL><DT><B>Since: </B><DD>JAXP 1.0</DD><DT><B>Version: </B><DD>1.0</DD></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected </CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/parsers/SAXParser.html#SAXParser()">SAXParser</A></B>()</CODE><BR> </TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../../org/xml/sax/Parser.html">Parser</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/parsers/SAXParser.html#getParser()">getParser</A></B>()</CODE><BR> Returns the SAX parser that is encapsultated by the implementation of this class.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract java.lang.Object</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/parsers/SAXParser.html#getProperty(java.lang.String)">getProperty</A></B>(java.lang.String name)</CODE><BR> Returns the particular property requested for in the underlying implementation of <A HREF="../../../org/xml/sax/XMLReader.html"><CODE>XMLReader</CODE></A>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../../org/xml/sax/XMLReader.html">XMLReader</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/parsers/SAXParser.html#getXMLReader()">getXMLReader</A></B>()</CODE><BR> Returns the <A HREF="../../../org/xml/sax/XMLReader.html"><CODE>XMLReader</CODE></A> that is encapsulated by the implementation of this class.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/parsers/SAXParser.html#isNamespaceAware()">isNamespaceAware</A></B>()</CODE><BR> Indicates whether or not this parser is configured to understand namespaces.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/parsers/SAXParser.html#isValidating()">isValidating</A></B>()</CODE><BR> Indicates whether or not this parser is configured to validate XML documents.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/parsers/SAXParser.html#parse(java.io.File, org.xml.sax.helpers.DefaultHandler)">parse</A></B>(java.io.File f, <A HREF="../../../org/xml/sax/helpers/DefaultHandler.html">DefaultHandler</A> dh)</CODE><BR> Parse the content of the file specified as XML using the specified <A HREF="../../../org/xml/sax/helpers/DefaultHandler.html"><CODE>DefaultHandler</CODE></A>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/parsers/SAXParser.html#parse(java.io.File, org.xml.sax.HandlerBase)">parse</A></B>(java.io.File f, <A HREF="../../../org/xml/sax/HandlerBase.html">HandlerBase</A> hb)</CODE><BR> Parse the content of the file specified as XML using the specified <A HREF="../../../org/xml/sax/HandlerBase.html"><CODE>HandlerBase</CODE></A>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/parsers/SAXParser.html#parse(org.xml.sax.InputSource, org.xml.sax.helpers.DefaultHandler)">parse</A></B>(<A HREF="../../../org/xml/sax/InputSource.html">InputSource</A> is, <A HREF="../../../org/xml/sax/helpers/DefaultHandler.html">DefaultHandler</A> dh)</CODE><BR> Parse the content given <A HREF="../../../org/xml/sax/InputSource.html"><CODE>InputSource</CODE></A> as XML using the specified <A HREF="../../../org/xml/sax/helpers/DefaultHandler.html"><CODE>DefaultHandler</CODE></A>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/parsers/SAXParser.html#parse(org.xml.sax.InputSource, org.xml.sax.HandlerBase)">parse</A></B>(<A HREF="../../../org/xml/sax/InputSource.html">InputSource</A> is, <A HREF="../../../org/xml/sax/HandlerBase.html">HandlerBase</A> hb)</CODE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -