📄 parser.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 Thu Apr 27 23:42:42 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class Parser</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/Parser.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-files/index-1.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><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../javax/swing/text/html/parser/Entity.html"><B>PREV CLASS</B></A> <A HREF="../../../../../javax/swing/text/html/parser/ParserDelegator.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="Parser.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <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.swing.text.html.parser</FONT><BR>Class Parser</H2><PRE><A HREF="../../../../../java/lang/Object.html">java.lang.Object</A> | +--<B>javax.swing.text.html.parser.Parser</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html">DTDConstants</A></DD></DL><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../../javax/swing/text/html/parser/DocumentParser.html">DocumentParser</A></DD></DL><HR><DL><DT>public class <B>Parser</B><DT>extends <A HREF="../../../../../java/lang/Object.html">Object</A><DT>implements <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html">DTDConstants</A></DL><P>A simple DTD-driven HTML parser. The parser reads an HTML file from an InputStream and calls various methods (which should be overridden in a subclass) when tags and data are encountered. <p> Unfortunately there are many badly implemented HTML parsers out there, and as a result there are many badly formatted HTML files. This parser attempts to parse most HTML files. This means that the implementation sometimes deviates from the SGML specification in favor of HTML. <p> The parser treats \r and \r\n as \n. Newlines after starttags and before end tags are ignored just as specified in the SGML/HTML specification.<P><DL><DT><B>See Also: </B><DD><A HREF="../../../../../javax/swing/text/html/parser/DTD.html"><CODE>DTD</CODE></A>, <A HREF="../../../../../javax/swing/text/html/parser/TagElement.html"><CODE>TagElement</CODE></A>, <A HREF="../../../../../javax/swing/text/SimpleAttributeSet.html"><CODE>SimpleAttributeSet</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../../../../javax/swing/text/html/parser/DTD.html">DTD</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#dtd">dtd</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#strict">strict</A></B></CODE><BR> This flag determines whether or not the Parser will be strict in enforcing SGML compatibility.</TD></TR></TABLE> <A NAME="fields_inherited_from_class_javax.swing.text.html.parser.DTDConstants"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from interface javax.swing.text.html.parser.<A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html">DTDConstants</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#ANY">ANY</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#CDATA">CDATA</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#CONREF">CONREF</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#CURRENT">CURRENT</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#DEFAULT">DEFAULT</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#EMPTY">EMPTY</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#ENDTAG">ENDTAG</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#ENTITIES">ENTITIES</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#ENTITY">ENTITY</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#FIXED">FIXED</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#GENERAL">GENERAL</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#ID">ID</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#IDREF">IDREF</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#IDREFS">IDREFS</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#IMPLIED">IMPLIED</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#MD">MD</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#MODEL">MODEL</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#MS">MS</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#NAME">NAME</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#NAMES">NAMES</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#NMTOKEN">NMTOKEN</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#NMTOKENS">NMTOKENS</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#NOTATION">NOTATION</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#NUMBER">NUMBER</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#NUMBERS">NUMBERS</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#NUTOKEN">NUTOKEN</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#NUTOKENS">NUTOKENS</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#PARAMETER">PARAMETER</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#PI">PI</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#PUBLIC">PUBLIC</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#RCDATA">RCDATA</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#REQUIRED">REQUIRED</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#SDATA">SDATA</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#STARTTAG">STARTTAG</A>, <A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html#SYSTEM">SYSTEM</A></CODE></TD></TR></TABLE> <!-- ======== 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><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#Parser(javax.swing.text.html.parser.DTD)">Parser</A></B>(<A HREF="../../../../../javax/swing/text/html/parser/DTD.html">DTD</A> dtd)</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>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#endTag(boolean)">endTag</A></B>(boolean omitted)</CODE><BR> Handle an end tag.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#error(java.lang.String)">error</A></B>(<A HREF="../../../../../java/lang/String.html">String</A> err)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#error(java.lang.String, java.lang.String)">error</A></B>(<A HREF="../../../../../java/lang/String.html">String</A> err, <A HREF="../../../../../java/lang/String.html">String</A> arg1)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#error(java.lang.String, java.lang.String, java.lang.String)">error</A></B>(<A HREF="../../../../../java/lang/String.html">String</A> err, <A HREF="../../../../../java/lang/String.html">String</A> arg1, <A HREF="../../../../../java/lang/String.html">String</A> arg2)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#error(java.lang.String, java.lang.String, java.lang.String, java.lang.String)">error</A></B>(<A HREF="../../../../../java/lang/String.html">String</A> err, <A HREF="../../../../../java/lang/String.html">String</A> arg1, <A HREF="../../../../../java/lang/String.html">String</A> arg2, <A HREF="../../../../../java/lang/String.html">String</A> arg3)</CODE><BR> Invoke the error handler.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#flushAttributes()">flushAttributes</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../../../../javax/swing/text/SimpleAttributeSet.html">SimpleAttributeSet</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#getAttributes()">getAttributes</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#getCurrentLine()">getCurrentLine</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#getCurrentPos()">getCurrentPos</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#handleComment(char[])">handleComment</A></B>(char[] text)</CODE><BR> Called when an HTML comment is encountered.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#handleEmptyTag(javax.swing.text.html.parser.TagElement)">handleEmptyTag</A></B>(<A HREF="../../../../../javax/swing/text/html/parser/TagElement.html">TagElement</A> tag)</CODE><BR> Called when an empty tag is encountered.</TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -