⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 documentparser.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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:41 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class  DocumentParser</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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/DocumentParser.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../../../javax/swing/text/html/parser/ContentModel.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../../../javax/swing/text/html/parser/DTD.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>  &nbsp;&nbsp;<A HREF="DocumentParser.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_javax.swing.text.html.parser.Parser">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<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  DocumentParser</H2><PRE><A HREF="../../../../../java/lang/Object.html">java.lang.Object</A>  |  +--<A HREF="../../../../../javax/swing/text/html/parser/Parser.html">javax.swing.text.html.parser.Parser</A>        |        +--<B>javax.swing.text.html.parser.DocumentParser</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../../javax/swing/text/html/parser/DTDConstants.html">DTDConstants</A></DD></DL><HR><DL><DT>public class <B>DocumentParser</B><DT>extends <A HREF="../../../../../javax/swing/text/html/parser/Parser.html">Parser</A></DL><P>A Parser for HTML Documents (actually, you can specify a DTD, but you should really only use this class with the html dtd in swing). Reads an InputStream of HTML and invokes the appropriate methods in the ParserCallback class. This is the default parser used by HTMLEditorKit to parse HTML url's. <p>This will message the callback for all valid tags, as well as tags that are implied but not explicitly specified. For example, the html string (&lt;p&gt;blah) only has a p tag defined. The callback will see the following methods: <ol><li><i>handleStartTag(html, ...)</i></li>     <li><i>handleStartTag(head, ...)</i></li>     <li><i>handleEndTag(head)</i></li>     <li><i>handleStartTag(body, ...)</i></li>     <li>handleStartTag(p, ...)</i></li>     <li>handleText(...)</li>     <li><i>handleEndTag(p)</i></li>     <li><i>handleEndTag(body)</i></li>     <li><i>handleEndTag(html)</i></li> </ol> The items in <i>italic</i> are implied, that is, although they were not explicitly specified, to be correct html they should have been present (head isn't necessary, but it is still generated). For tags that are implied, the AttributeSet argument will have a value of <code>Boolean.TRUE</code> for the key <code>HTMLEditorKit.ParserCallback.IMPLIED</code>. <p>HTML.Attributes defines a type safe enumeration of html attributes. If an attribute key of a tag is defined in HTML.Attribute, the HTML.Attribute will be used as the key, otherwise a String will be used. For example &lt;p foo=bar class=neat&gt; has two attributes. foo is not defined in HTML.Attribute, where as class is, therefore the AttributeSet will have two values in it, HTML.Attribute.CLASS with a String value of 'neat' and the String key 'foo' with a String value of 'bar'. <p>The position argument will indicate the start of the tag, comment or text. Similiar to arrays, the first character in the stream has a position of 0. For tags that are implied the position will indicate the location of the next encountered tag. In the first example, the implied start body and html tags will have the same position as the p tag, and the implied end p, html and body tags will all have the same position. <p>As html skips whitespace the position for text will be the position of the first valid character, eg in the string '\n\n\nblah' the text 'blah' will have a position of 3, the newlines are skipped. <p> For attributes that do not have a value, eg in the html string <code>&lt;foo blah&gt;</code> the attribute <code>blah</code> does not have a value, there are two possible values that will be placed in the AttributeSet's value: <ul> <li>If the DTD does not contain an definition for the element, or the     definition does not have an explicit value then the value in the     AttributeSet will be <code>HTML.NULL_ATTRIBUTE_VALUE</code>. <li>If the DTD contains an explicit value, as in:     <code>&lt;!ATTLIST OPTION selected (selected) #IMPLIED&gt;</code>     this value from the dtd (in this case selected) will be used. </ul> <p> Once the stream has been parsed, the callback is notified of the most likely end of line string. The end of line string will be one of \n, \r or \r\n, which ever is encountered the most in parsing the stream.<P><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="fields_inherited_from_class_javax.swing.text.html.parser.Parser"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from class javax.swing.text.html.parser.<A HREF="../../../../../javax/swing/text/html/parser/Parser.html">Parser</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../../../javax/swing/text/html/parser/Parser.html#dtd">dtd</A>, <A HREF="../../../../../javax/swing/text/html/parser/Parser.html#strict">strict</A></CODE></TD></TR></TABLE>&nbsp;<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>&nbsp;<!-- ======== 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/DocumentParser.html#DocumentParser(javax.swing.text.html.parser.DTD)">DocumentParser</A></B>(<A HREF="../../../../../javax/swing/text/html/parser/DTD.html">DTD</A>&nbsp;dtd)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR></TABLE>&nbsp;<!-- ========== 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 &nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/DocumentParser.html#handleComment(char[])">handleComment</A></B>(char[]&nbsp;text)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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 &nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/DocumentParser.html#handleEmptyTag(javax.swing.text.html.parser.TagElement)">handleEmptyTag</A></B>(<A HREF="../../../../../javax/swing/text/html/parser/TagElement.html">TagElement</A>&nbsp;tag)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Handle Empty Tag.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../javax/swing/text/html/parser/DocumentParser.html#handleEndTag(javax.swing.text.html.parser.TagElement)">handleEndTag</A></B>(<A HREF="../../../../../javax/swing/text/html/parser/TagElement.html">TagElement</A>&nbsp;tag)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Handle End Tag.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -