📄 contenthandler.html
字号:
<BR> Receive notification of the beginning of a document.</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="../../../org/xml/sax/ContentHandler.html#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)">startElement</A></B>(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, <A HREF="../../../org/xml/sax/Attributes.html">Attributes</A> atts)</CODE><BR> Receive notification of the beginning of an element.</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="../../../org/xml/sax/ContentHandler.html#startPrefixMapping(java.lang.String, java.lang.String)">startPrefixMapping</A></B>(java.lang.String prefix, java.lang.String uri)</CODE><BR> Begin the scope of a prefix-URI Namespace mapping.</TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="setDocumentLocator(org.xml.sax.Locator)"><!-- --></A><H3>setDocumentLocator</H3><PRE>public void <B>setDocumentLocator</B>(<A HREF="../../../org/xml/sax/Locator.html">Locator</A> locator)</PRE><DL><DD>Receive an object for locating the origin of SAX document events. <p>SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the ContentHandler interface.</p> <p>The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.</p> <p>Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.</p><DD><DL><DT><B>Parameters:</B><DD><CODE>locator</CODE> - An object that can return the location of any SAX document event.<DT><B>See Also: </B><DD><A HREF="../../../org/xml/sax/Locator.html"><CODE>Locator</CODE></A></DL></DD></DL><HR><A NAME="startDocument()"><!-- --></A><H3>startDocument</H3><PRE>public void <B>startDocument</B>() throws <A HREF="../../../org/xml/sax/SAXException.html">SAXException</A></PRE><DL><DD>Receive notification of the beginning of a document. <p>The SAX parser will invoke this method only once, before any other methods in this interface or in <A HREF="../../../org/xml/sax/DTDHandler.html"><CODE>DTDHandler</CODE></A> (except for <A HREF="../../../org/xml/sax/ContentHandler.html#setDocumentLocator(org.xml.sax.Locator)"><CODE>setDocumentLocator</CODE></A>).</p><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../org/xml/sax/SAXException.html">SAXException</A></CODE> - Any SAX exception, possibly wrapping another exception.<DT><B>See Also: </B><DD><A HREF="../../../org/xml/sax/ContentHandler.html#endDocument()"><CODE>endDocument()</CODE></A></DL></DD></DL><HR><A NAME="endDocument()"><!-- --></A><H3>endDocument</H3><PRE>public void <B>endDocument</B>() throws <A HREF="../../../org/xml/sax/SAXException.html">SAXException</A></PRE><DL><DD>Receive notification of the end of a document. <p>The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.</p><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../org/xml/sax/SAXException.html">SAXException</A></CODE> - Any SAX exception, possibly wrapping another exception.<DT><B>See Also: </B><DD><A HREF="../../../org/xml/sax/ContentHandler.html#startDocument()"><CODE>startDocument()</CODE></A></DL></DD></DL><HR><A NAME="startPrefixMapping(java.lang.String, java.lang.String)"><!-- --></A><H3>startPrefixMapping</H3><PRE>public void <B>startPrefixMapping</B>(java.lang.String prefix, java.lang.String uri) throws <A HREF="../../../org/xml/sax/SAXException.html">SAXException</A></PRE><DL><DD>Begin the scope of a prefix-URI Namespace mapping. <p>The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the <code>http://xml.org/sax/features/namespaces</code> feature is <var>true</var> (the default).</p> <p>There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary.</p> <p>Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding <A HREF="../../../org/xml/sax/ContentHandler.html#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)"><CODE>startElement</CODE></A> event, and all <A HREF="../../../org/xml/sax/ContentHandler.html#endPrefixMapping(java.lang.String)"><CODE>endPrefixMapping</CODE></A> events will occur after the corresponding <A HREF="../../../org/xml/sax/ContentHandler.html#endElement(java.lang.String, java.lang.String, java.lang.String)"><CODE>endElement</CODE></A> event, but their order is not otherwise guaranteed.</p> <p>There should never be start/endPrefixMapping events for the "xml" prefix, since it is predeclared and immutable.</p><DD><DL><DT><B>Parameters:</B><DD><CODE>prefix</CODE> - The Namespace prefix being declared.<DD><CODE>uri</CODE> - The Namespace URI the prefix is mapped to.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/xml/sax/SAXException.html">SAXException</A></CODE> - The client may throw an exception during processing.<DT><B>See Also: </B><DD><A HREF="../../../org/xml/sax/ContentHandler.html#endPrefixMapping(java.lang.String)"><CODE>endPrefixMapping(java.lang.String)</CODE></A>, <A HREF="../../../org/xml/sax/ContentHandler.html#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)"><CODE>startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)</CODE></A></DL></DD></DL><HR><A NAME="endPrefixMapping(java.lang.String)"><!-- --></A><H3>endPrefixMapping</H3><PRE>public void <B>endPrefixMapping</B>(java.lang.String prefix) throws <A HREF="../../../org/xml/sax/SAXException.html">SAXException</A></PRE><DL><DD>End the scope of a prefix-URI mapping. <p>See <A HREF="../../../org/xml/sax/ContentHandler.html#startPrefixMapping(java.lang.String, java.lang.String)"><CODE>startPrefixMapping</CODE></A> for details. This event will always occur after the corresponding <A HREF="../../../org/xml/sax/ContentHandler.html#endElement(java.lang.String, java.lang.String, java.lang.String)"><CODE>endElement</CODE></A> event, but the order of <A HREF="../../../org/xml/sax/ContentHandler.html#endPrefixMapping(java.lang.String)"><CODE>endPrefixMapping</CODE></A> events is not otherwise guaranteed.</p><DD><DL><DT><B>Parameters:</B><DD><CODE>prefix</CODE> - The prefix that was being mapping.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/xml/sax/SAXException.html">SAXException</A></CODE> - The client may throw an exception during processing.<DT><B>See Also: </B><DD><A HREF="../../../org/xml/sax/ContentHandler.html#startPrefixMapping(java.lang.String, java.lang.String)"><CODE>startPrefixMapping(java.lang.String, java.lang.String)</CODE></A>, <A HREF="../../../org/xml/sax/ContentHandler.html#endElement(java.lang.String, java.lang.String, java.lang.String)"><CODE>endElement(java.lang.String, java.lang.String, java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)"><!-- --></A><H3>startElement</H3><PRE>public void <B>startElement</B>(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, <A HREF="../../../org/xml/sax/Attributes.html">Attributes</A> atts) throws <A HREF="../../../org/xml/sax/SAXException.html">SAXException</A></PRE><DL><DD>Receive notification of the beginning of an element. <p>The Parser will invoke this method at the beginning of every element in the XML document; there will be a corresponding <A HREF="../../../org/xml/sax/ContentHandler.html#endElement(java.lang.String, java.lang.String, java.lang.String)"><CODE>endElement</CODE></A> event for every startElement event (even when the element is empty). All of the element's content will be reported, in order, before the corresponding endElement event.</p> <p>This event allows up to three name components for each element:</p> <ol> <li>the Namespace URI;</li> <li>the local name; and</li> <li>the qualified (prefixed) name.</li> </ol> <p>Any or all of these may be provided, depending on the values of the <var>http://xml.org/sax/features/namespaces</var> and the <var>http://xml.org/sax/features/namespace-prefixes</var> properties:</p> <ul> <li>the Namespace URI and local name are required when the namespaces property is <var>true</var> (the default), and are optional when the namespaces property is <var>false</var> (if one is specified, both must be);</li> <li>the qualified name is required when the namespace-prefixes property is <var>true</var>, and is optional when the namespace-prefixes property is <var>false</var> (the default).</li> </ul>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -