亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? parser.java

?? JAVA的一些源碼 JAVA2 STANDARD EDITION DEVELOPMENT KIT 5.0
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
/* * @(#)Parser.java	1.43 05/05/27 * * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package javax.swing.text.html.parser;import javax.swing.text.SimpleAttributeSet;import javax.swing.text.html.HTML;import javax.swing.text.ChangedCharSetException;import java.io.*;import java.util.Hashtable;import java.util.Properties;import java.util.Vector;import java.util.Enumeration;import java.net.URL;import sun.misc.MessageUtils;/** * 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> * The html spec does not specify how spaces are to be coalesced very well. * Specifically, the following scenarios are not discussed (note that a * space should be used here, but I am using &amp;nbsp to force the space to * be displayed): * <p> * '&lt;b>blah&nbsp;&lt;i>&nbsp;&lt;strike>&nbsp;foo' which can be treated as: * '&lt;b>blah&nbsp;&lt;i>&lt;strike>foo'  * <p>as well as: * '&lt;p>&lt;a href="xx">&nbsp;&lt;em>Using&lt;/em>&lt;/a>&lt;/p>' * which appears to be treated as: * '&lt;p>&lt;a href="xx">&lt;em>Using&lt;/em>&lt;/a>&lt;/p>' * <p> * If <code>strict</code> is false, when a tag that breaks flow, * (<code>TagElement.breaksFlows</code>) or trailing whitespace is * encountered, all whitespace will be ignored until a non whitespace * character is encountered. This appears to give behavior closer to * the popular browsers. * * @see DTD * @see TagElement * @see SimpleAttributeSet * @version 1.43, 05/27/05 * @author Arthur van Hoff * @author Sunita Mani */publicclass Parser implements DTDConstants {    private char text[] = new char[1024];    private int textpos = 0;    private TagElement last;    private boolean space;    private char str[] = new char[128];    private int strpos = 0;    protected DTD dtd = null;    private int ch;    private int ln;    private Reader in;    private Element recent;    private TagStack stack;    private boolean skipTag = false;    private TagElement lastFormSent = null;    private SimpleAttributeSet attributes = new SimpleAttributeSet();    // State for <html>, <head> and <body>.  Since people like to slap    // together HTML documents without thinking, occasionally they    // have multiple instances of these tags.  These booleans track    // the first sightings of these tags so they can be safely ignored    // by the parser if repeated.    private boolean seenHtml = false;    private boolean seenHead = false;    private boolean seenBody = false;    /**     * The html spec does not specify how spaces are coalesced very well.     * If strict == false, ignoreSpace is used to try and mimic the behavior     * of the popular browsers.     * <p>     * The problematic scenarios are:     * '&lt;b>blah &lt;i> &lt;strike> foo' which can be treated as:     * '&lt;b>blah &lt;i>&lt;strike>foo'     * as well as:     * '&lt;p>&lt;a href="xx"> &lt;em>Using&lt;/em>&lt;/a>&lt;/p>'     * which appears to be treated as:     * '&lt;p>&lt;a href="xx">&lt;em>Using&lt;/em>&lt;/a>&lt;/p>'     * <p>     * When a tag that breaks flow, or trailing whitespace is encountered     * ignoreSpace is set to true. From then on, all whitespace will be     * ignored.     * ignoreSpace will be set back to false the first time a     * non whitespace character is encountered. This appears to give     * behavior closer to the popular browsers.     */    private boolean ignoreSpace;    /**     * This flag determines whether or not the Parser will be strict     * in enforcing SGML compatibility.  If false, it will be lenient     * with certain common classes of erroneous HTML constructs.     * Strict or not, in either case an error will be recorded.     *     */    protected boolean strict = false;    /** Number of \r\n's encountered. */    private int crlfCount;    /** Number of \r's encountered. A \r\n will not increment this. */    private int crCount;    /** Number of \n's encountered. A \r\n will not increment this. */    private int lfCount;    //    // To correctly identify the start of a tag/comment/text we need two    // ivars. Two are needed as handleText isn't invoked until the tag    // after the text has been parsed, that is the parser parses the text,    // then a tag, then invokes handleText followed by handleStart.    //    /** The start position of the current block. Block is overloaded here,     * it really means the current start position for the current comment,     * tag, text. Use getBlockStartPosition to access this. */    private int currentBlockStartPos;    /** Start position of the last block. */    private int lastBlockStartPos;    /**     * array for mapping numeric references in range     * 130-159 to displayable Unicode characters.     */    private static final char[] cp1252Map = {        8218,  // &#130;        402,   // &#131;        8222,  // &#132;        8230,  // &#133;        8224,  // &#134;        8225,  // &#135;        710,   // &#136;        8240,  // &#137;        352,   // &#138;        8249,  // &#139;        338,   // &#140;        141,   // &#141;        142,   // &#142;        143,   // &#143;        144,   // &#144;        8216,  // &#145;        8217,  // &#146;        8220,  // &#147;        8221,  // &#148;        8226,  // &#149;        8211,  // &#150;        8212,  // &#151;        732,   // &#152;        8482,  // &#153;        353,   // &#154;        8250,  // &#155;        339,   // &#156;        157,   // &#157;        158,   // &#158;        376    // &#159;    };    public Parser(DTD dtd) {	this.dtd = dtd;    }    /**     * @return the line number of the line currently being parsed     */    protected int getCurrentLine() {	return ln;    }    /**     * Returns the start position of the current block. Block is     * overloaded here, it really means the current start position for     * the current comment tag, text, block.... This is provided for     * subclassers that wish to know the start of the current block when     * called with one of the handleXXX methods.     */    int getBlockStartPosition() {	return Math.max(0, lastBlockStartPos - 1);    }    /**     * Makes a TagElement.     */    protected TagElement makeTag(Element elem, boolean fictional) {	return new TagElement(elem, fictional);    }    protected TagElement makeTag(Element elem) {	return makeTag(elem, false);    }    protected SimpleAttributeSet getAttributes() {	return attributes;    }    protected void flushAttributes() {	attributes.removeAttributes(attributes);    }    /**     * Called when PCDATA is encountered.     */    protected void handleText(char text[]) {    }    /**     * Called when an HTML title tag is encountered.     */    protected void handleTitle(char text[]) {	// default behavior is to call handleText. Subclasses	// can override if necessary.	handleText(text);    }    /**     * Called when an HTML comment is encountered.     */    protected void handleComment(char text[]) {    }    protected void handleEOFInComment() {	// We've reached EOF.  Our recovery strategy is to	// see if we have more than one line in the comment;	// if so, we pretend that the comment was an unterminated	// single line comment, and reparse the lines after the	// first line as normal HTML content.	int commentEndPos = strIndexOf('\n');	if (commentEndPos >= 0) {	    handleComment(getChars(0, commentEndPos));	    try {		in.close();		in = new CharArrayReader(getChars(commentEndPos + 1));		ch = '>';	    } catch (IOException e) {		error("ioexception");	    }	    resetStrBuffer();	} else {	    // no newline, so signal an error	    error("eof.comment");	}    }    /**     * Called when an empty tag is encountered.     */    protected void handleEmptyTag(TagElement tag) throws ChangedCharSetException {    }    /**     * Called when a start tag is encountered.     */    protected void handleStartTag(TagElement tag) {    }    /**     * Called when an end tag is encountered.     */    protected void handleEndTag(TagElement tag) {    }    /**     * An error has occurred.     */    protected void handleError(int ln, String msg) {	/*	Thread.dumpStack();	System.out.println("**** " + stack);	System.out.println("line " + ln + ": error: " + msg);	System.out.println();	*/    }    /**     * Output text.     */    void handleText(TagElement tag) {	if (tag.breaksFlow()) {	    space = false;            if (!strict) {                ignoreSpace = true;            }	}	if (textpos == 0) {	    if ((!space) || (stack == null) || last.breaksFlow() ||		!stack.advance(dtd.pcdata)) {		last = tag;		space = false;		lastBlockStartPos = currentBlockStartPos;		return;	    }	}	if (space) {            if (!ignoreSpace) {                // enlarge buffer if needed                if (textpos + 1 > text.length) {                    char newtext[] = new char[text.length + 200];                    System.arraycopy(text, 0, newtext, 0, text.length);                    text = newtext;                }                // output pending space                text[textpos++] = ' ';                if (!strict && !tag.getElement().isEmpty()) {                    ignoreSpace = true;                }            }            space = false;	}	char newtext[] = new char[textpos];	System.arraycopy(text, 0, newtext, 0, textpos);	// Handles cases of bad html where the title tag	// was getting lost when we did error recovery.	if (tag.getElement().getName().equals("title")) {	    handleTitle(newtext);        } else {	    handleText(newtext);	}	lastBlockStartPos = currentBlockStartPos;	textpos = 0;	last = tag;	space = false;    }    /**     * Invoke the error handler.     */    protected void error(String err, String arg1, String arg2,	String arg3) {	// big hack, but this should never get used...	handleError (ln, err + arg1 + arg2 + arg3);    }    protected void error(String err, String arg1, String arg2) {	error(err, arg1, arg2, "?");    }    protected void error(String err, String arg1) {	error(err, arg1, "?", "?");    }    protected void error(String err) {	error(err, "?", "?", "?");    }    /**     * Handle a start tag. The new tag is pushed     * onto the tag stack. The attribute list is     * checked for required attributes.     */    protected void startTag(TagElement tag) throws ChangedCharSetException {	Element elem = tag.getElement();	// If the tag is an empty tag and texpos != 0	// this implies that there is text before the	// start tag that needs to be processed before	// handling the tag.	//	if (!elem.isEmpty() || textpos != 0) {	    handleText(tag);	} else {	    // this variable gets updated in handleText().	    // Since in this case we do not call handleText()	    // we need to update it here.	    //	    last = tag;	    // Note that we should really check last.breakFlows before	    // assuming this should be false.	    space = false;	}	lastBlockStartPos = currentBlockStartPos;	// check required attributes	for (AttributeList a = elem.atts ; a != null ; a = a.next) {	    if ((a.modifier == REQUIRED) && ((attributes.isEmpty()) || (!attributes.isDefined(a.name)))) {		error("req.att ", a.getName(), elem.getName());	    }	}	if (elem.isEmpty()) {	    handleEmptyTag(tag);            /*	} else if (elem.getName().equals("form")) {	    handleStartTag(tag);            */	} else {	    recent = elem;	    stack = new TagStack(tag, stack);	    handleStartTag(tag);	}    }    /**     * Handle an end tag. The end tag is popped     * from the tag stack.     */    protected void endTag(boolean omitted) {	handleText(stack.tag);	if (omitted && !stack.elem.omitEnd()) {	    error("end.missing", stack.elem.getName());	} else if (!stack.terminate()) {	    error("end.unexpected", stack.elem.getName());	}	// handle the tag	handleEndTag(stack.tag);	stack = stack.next;	recent = (stack != null) ? stack.elem : null;    }    boolean ignoreElement(Element elem) {        String stackElement = stack.elem.getName();	String elemName = elem.getName();	/* We ignore all elements that are not valid in the context of	   a table except <td>, <th> (these we handle in	   legalElementContext()) and #pcdata.  We also ignore the	   <font> tag in the context of <ul> and <ol> We additonally	   ignore the <meta> and the <style> tag if the body tag has	   been seen. **/	if ((elemName.equals("html") && seenHtml) ||	    (elemName.equals("head") && seenHead) ||	    (elemName.equals("body") && seenBody)) {	    return true;	}	if (elemName.equals("dt") || elemName.equals("dd")) {	    TagStack s = stack;	    while (s != null && !s.elem.getName().equals("dl")) {		s = s.next;	    }	    if (s == null) {		return true;	    }	}	if (((stackElement.equals("table")) &&	     (!elemName.equals("#pcdata")) && (!elemName.equals("input"))) ||	    ((elemName.equals("font")) &&	     (stackElement.equals("ul") || stackElement.equals("ol"))) ||	    (elemName.equals("meta") && stack != null) ||	    (elemName.equals("style") && seenBody) ||	    (stackElement.equals("table") && elemName.equals("a"))) {	    return true;	}	return false;    }    /**     * Marks the first time a tag has been seen in a document     */    protected void markFirstTime(Element elem) {	String elemName = elem.getName();	if (elemName.equals("html")) {	    seenHtml = true;	} else if (elemName.equals("head")) {	    seenHead = true;	} else if (elemName.equals("body")) {            if (buf.length == 1) {                // Refer to note in definition of buf for details on this.                char[] newBuf = new char[256];                newBuf[0] = buf[0];                buf = newBuf;            }	    seenBody = true;	}    }    /**     * Create a legal content for an element.     */    boolean legalElementContext(Element elem) throws ChangedCharSetException {	// System.out.println("-- legalContext -- " + elem);	// Deal with the empty stack	if (stack == null) {	    // System.out.println("-- stack is empty");	    if (elem != dtd.html) {		// System.out.println("-- pushing html");		startTag(makeTag(dtd.html, true));		return legalElementContext(elem);	    }	    return true;	}	// Is it allowed in the current context	if (stack.advance(elem)) {	    // System.out.println("-- legal context");	    markFirstTime(elem);	    return true;	}	boolean insertTag = false;	// The use of all error recovery strategies are contingent	// on the value of the strict property.	//	// These are commonly occuring errors.  if insertTag is true,	// then we want to adopt an error recovery strategy that	// involves attempting to insert an additional tag to	// legalize the context.  The two errors addressed here	// are:	// 1) when a <td> or <th> is seen soon after a <table> tag.	//    In this case we insert a <tr>.	// 2) when any other tag apart from a <tr> is seen	//    in the context of a <tr>.  In this case we would	//    like to add a <td>.  If a <tr> is seen within a	//    <tr> context, then we will close out the current	//    <tr>.	//	// This insertion strategy is handled later in the method.	// The reason for checking this now, is that in other cases	// we would like to apply other error recovery strategies for example	// ignoring tags.	//	// In certain cases it is better to ignore a tag than try to	// fix the situation.  So the first test is to see if this	// is what we need to do.	//	String stackElemName = stack.elem.getName();	String elemName = elem.getName();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品一区二| 成人h精品动漫一区二区三区| 亚洲同性同志一二三专区| 久久精品人人做人人爽人人| 精品日韩欧美一区二区| 日韩美女视频在线| 久久综合国产精品| 久久久久久免费| 久久精品在这里| 亚洲国产精品二十页| 久久久欧美精品sm网站| 国产日韩精品一区二区三区在线| www国产成人| 国产精品嫩草99a| 自拍偷拍亚洲激情| 亚洲午夜免费电影| 麻豆91在线观看| 国产精品一区二区x88av| 国产成人精品aa毛片| 99精品久久99久久久久| 欧美三级中文字幕在线观看| 欧美福利视频一区| 日韩欧美专区在线| 国产欧美日韩另类一区| 亚洲少妇中出一区| 调教+趴+乳夹+国产+精品| 精品在线免费视频| av网站免费线看精品| 欧美丝袜丝nylons| 久久综合久久鬼色| 亚洲精品欧美在线| 久久99久久精品| 国产成人综合亚洲91猫咪| 91热门视频在线观看| 7777精品伊人久久久大香线蕉经典版下载| 日韩欧美一级精品久久| 国产欧美日韩激情| 午夜视频在线观看一区二区三区 | 成人精品小蝌蚪| 欧美日韩中文另类| 久久久三级国产网站| 亚洲综合色噜噜狠狠| 久久精品免费观看| 色综合久久99| 精品国产一区二区三区av性色| 中文字幕一区二区三区乱码在线| 成人午夜激情视频| 欧美视频日韩视频| 久久久久久麻豆| 天天av天天翘天天综合网| 国产老肥熟一区二区三区| 91黄视频在线| 国产欧美视频在线观看| 日韩av电影免费观看高清完整版| 成人国产精品免费观看动漫| 日韩一区和二区| 亚洲精品国产成人久久av盗摄 | 不卡av电影在线播放| 51精品久久久久久久蜜臀| 国产精品久久毛片| 久久国产生活片100| 在线一区二区视频| 国产三级欧美三级日产三级99| 五月天久久比比资源色| 91在线你懂得| 国产三级精品视频| 蜜臀va亚洲va欧美va天堂| 欧美性色欧美a在线播放| 国产农村妇女毛片精品久久麻豆| 免费高清视频精品| 欧美午夜一区二区| 亚洲人吸女人奶水| 丰满岳乱妇一区二区三区 | 亚洲bt欧美bt精品| 97久久精品人人做人人爽| 久久久久久免费网| 狂野欧美性猛交blacked| 欧美日韩一卡二卡三卡| 一区二区三区四区激情 | 国产清纯白嫩初高生在线观看91| 五月天欧美精品| 欧美午夜精品久久久久久孕妇| 中文字幕电影一区| 国产精品亚洲专一区二区三区| 欧美一级高清大全免费观看| 丝袜脚交一区二区| 欧美日韩免费一区二区三区| 亚洲精品视频免费观看| www.欧美亚洲| 中文字幕视频一区二区三区久| 国产二区国产一区在线观看| 精品久久久久一区| 激情综合网激情| 26uuu精品一区二区| 久久不见久久见免费视频1| 欧美一区二区久久| 老色鬼精品视频在线观看播放| 欧美一区在线视频| 日韩国产高清影视| 91精品麻豆日日躁夜夜躁| 亚洲第一久久影院| 在线成人av网站| 老司机午夜精品| 久久综合网色—综合色88| 国产一区二区导航在线播放| 久久久久综合网| 国产乱色国产精品免费视频| 久久精品一区四区| 成人免费高清在线观看| 中文字幕在线播放不卡一区| 91视频观看免费| 国产乱人伦偷精品视频免下载| 国产日韩欧美综合在线| 成人app软件下载大全免费| 综合久久久久久| 在线观看国产一区二区| 午夜精彩视频在线观看不卡| 制服丝袜国产精品| 精品一区二区在线免费观看| 国产欧美一区二区三区沐欲| 91美女蜜桃在线| 亚洲大型综合色站| 欧美变态口味重另类| 国产成人综合亚洲91猫咪| 中文字幕佐山爱一区二区免费| 色综合网站在线| 日日夜夜一区二区| 久久综合久久鬼色中文字| 成人av免费在线| 亚洲一二三区不卡| 精品欧美一区二区三区精品久久 | 欧美日韩国产高清一区二区| 激情综合色播激情啊| 国产精品乱码人人做人人爱| 91看片淫黄大片一级| 日韩成人精品视频| 国产校园另类小说区| 色综合久久精品| 老色鬼精品视频在线观看播放| 国产精品乱人伦一区二区| 欧美日韩精品一二三区| 国产乱子伦一区二区三区国色天香| 国产精品久久久久影院| 欧美午夜一区二区三区| 国内精品视频一区二区三区八戒 | 国产一区二区在线视频| 国产精品家庭影院| 欧美一区二区三区四区久久| 成人一区二区三区视频 | 99免费精品视频| 日欧美一区二区| 国产精品白丝在线| 欧美一区二区视频在线观看2022| 成人美女在线视频| 日本不卡在线视频| 中文字幕一区二区三区四区不卡| 91麻豆精品国产91久久久资源速度| 春色校园综合激情亚洲| 天堂午夜影视日韩欧美一区二区| 欧美激情一区二区三区四区| 91精品黄色片免费大全| 91香蕉视频mp4| 国产精品一区二区果冻传媒| 午夜欧美电影在线观看| 国产精品乱码久久久久久| 日韩三级伦理片妻子的秘密按摩| 97精品国产97久久久久久久久久久久| 麻豆成人在线观看| 亚洲一卡二卡三卡四卡| 国产精品免费久久| 日韩美女一区二区三区四区| 欧美日韩一级二级| 91啪在线观看| 成人深夜视频在线观看| 精油按摩中文字幕久久| 视频一区在线播放| 亚洲一区二区三区三| |精品福利一区二区三区| 久久久精品免费网站| 日韩一级黄色片| 欧美日韩精品久久久| 日本韩国欧美在线| 白白色 亚洲乱淫| 4438成人网| 欧美色图第一页| 在线观看三级视频欧美| 色先锋资源久久综合| caoporn国产精品| 高清不卡一区二区| 国产一区福利在线| 黑人精品欧美一区二区蜜桃| 日韩高清一区二区| 日日夜夜精品视频天天综合网| 亚洲综合免费观看高清完整版在线 | 亚洲国产精品久久一线不卡| 一区二区三区**美女毛片| 亚洲免费av高清| 亚洲欧美日韩国产综合| 综合久久久久久久| 亚洲人快播电影网|