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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dtdparser.java

?? XML的DTD的解析、對XML文件作用的JAVA源代碼。
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package com.wutka.dtd;import java.util.*;import java.io.*;import java.net.*;/** Parses a DTD file and returns a DTD object * * @author Mark Wutka * @version $Revision: 1.19 $ $Date: 2002/10/01 12:48:47 $ by $Author: wutka $ */public class DTDParser implements EntityExpansion{    protected Scanner scanner;    protected DTD dtd;    protected Object defaultLocation;/** Creates a parser that will read from the specified Reader object */    public DTDParser(Reader in)    {        scanner = new Scanner(in, false, this);        dtd = new DTD();    }/** Creates a parser that will read from the specified Reader object * @param in The input stream to read * @param trace True if the parser should print out tokens as it reads them *  (used for debugging the parser) */    public DTDParser(Reader in, boolean trace)    {        scanner = new Scanner(in, trace, this);        dtd = new DTD();    }/** Creates a parser that will read from the specified File object */    public DTDParser(File in)        throws IOException    {        defaultLocation = in.getParentFile();        scanner = new Scanner(new BufferedReader(new FileReader(in)),            false, this);        dtd = new DTD();    }/** Creates a parser that will read from the specified File object * @param in The file to read * @param trace True if the parser should print out tokens as it reads them *  (used for debugging the parser) */    public DTDParser(File in, boolean trace)        throws IOException    {        defaultLocation = in.getParentFile();        scanner = new Scanner(new BufferedReader(new FileReader(in)),            trace, this);        dtd = new DTD();    }/** Creates a parser that will read from the specified URL object */    public DTDParser(URL in)        throws IOException    {    //LAM: we need to set the defaultLocation to the directory where    //the dtd is found so that we don't run into problems parsing any    //relative external files referenced by the dtd.        String file = in.getFile();        defaultLocation = new URL(in.getProtocol(), in.getHost(), in.getPort(), file.substring(0, file.lastIndexOf('/') + 1));        scanner = new Scanner(new BufferedReader(            new InputStreamReader(in.openStream())), false, this);        dtd = new DTD();    }/** Creates a parser that will read from the specified URL object * @param in The URL to read * @param trace True if the parser should print out tokens as it reads them *  (used for debugging the parser) */    public DTDParser(URL in, boolean trace)        throws IOException    {    //LAM: we need to set the defaultLocation to the directory where    //the dtd is found so that we don't run into problems parsing any    //relative external files referenced by the dtd.        String file = in.getFile();        defaultLocation = new URL(in.getProtocol(), in.getHost(), in.getPort(), file.substring(0, file.lastIndexOf('/') + 1));        scanner = new Scanner(new BufferedReader(            new InputStreamReader(in.openStream())), trace, this);        dtd = new DTD();    }/** Parses the DTD file and returns a DTD object describing the DTD.    This invocation of parse does not try to guess the root element    (for efficiency reasons) */    public DTD parse()        throws IOException    {        return parse(false);    }/** Parses the DTD file and returns a DTD object describing the DTD. * @param guessRootElement If true, tells the parser to try to guess the          root element of the document by process of elimination */    public DTD parse(boolean guessRootElement)        throws IOException    {        Token token;        for (;;)        {            token = scanner.peek();            if (token.type == Scanner.EOF) break;            parseTopLevelElement();        }        if (guessRootElement)        {            Hashtable roots = new Hashtable();            Enumeration e = dtd.elements.elements();            while (e.hasMoreElements())            {                DTDElement element = (DTDElement) e.nextElement();                roots.put(element.name, element);            }            e = dtd.elements.elements();            while (e.hasMoreElements())            {                DTDElement element = (DTDElement) e.nextElement();                if (!(element.content instanceof DTDContainer)) continue;                Enumeration items = ((DTDContainer) element.content).                    getItemsVec().  elements();                while (items.hasMoreElements())                {                    removeElements(roots, dtd, (DTDItem) items.nextElement());                }            }            if (roots.size() == 1)            {                e = roots.elements();                dtd.rootElement = (DTDElement) e.nextElement();            }            else            {                dtd.rootElement = null;            }        }        else        {            dtd.rootElement = null;        }        return dtd;    }    protected void removeElements(Hashtable h, DTD dtd, DTDItem item)    {        if (item instanceof DTDName)        {            h.remove(((DTDName) item).value);        }        else if (item instanceof DTDContainer)        {            Enumeration e = ((DTDContainer) item).getItemsVec().elements();            while (e.hasMoreElements())            {                removeElements(h, dtd, (DTDItem) e.nextElement());            }        }    }    protected void parseTopLevelElement()        throws IOException    {        Token token = scanner.get();// Is <? xxx ?> even valid in a DTD?  I'll ignore it just in case it's there        if (token.type == Scanner.LTQUES)        {            StringBuffer textBuffer = new StringBuffer();            for (;;)            {                String text = scanner.getUntil('?');                textBuffer.append(text);                token = scanner.peek();                if (token.type == Scanner.GT)                {                    scanner.get();                    break;                }                textBuffer.append('?');            }            DTDProcessingInstruction instruct =                new DTDProcessingInstruction(textBuffer.toString());            dtd.items.addElement(instruct);            return;        }        else if (token.type == Scanner.CONDITIONAL)        {            token = expect(Scanner.IDENTIFIER);            if (token.value.equals("IGNORE"))            {                scanner.skipConditional();            }            else            {                if (token.value.equals("INCLUDE"))                {                    scanner.skipUntil('[');                }                else                {                    throw new DTDParseException(scanner.getUriId(),                        "Invalid token in conditional: "+token.value,                        scanner.getLineNumber(), scanner.getColumn());                }            }        }        else if (token.type == Scanner.ENDCONDITIONAL)        {            // Don't need to do anything for this token        }        else if (token.type == Scanner.COMMENT)        {            dtd.items.addElement(                new DTDComment(token.value));        }        else if (token.type == Scanner.LTBANG)        {            token = expect(Scanner.IDENTIFIER);            if (token.value.equals("ELEMENT"))            {                parseElement();            }            else if (token.value.equals("ATTLIST"))            {                parseAttlist();            }            else if (token.value.equals("ENTITY"))            {                parseEntity();            }            else if (token.value.equals("NOTATION"))            {                parseNotation();            }            else            {                skipUntil(Scanner.GT);            }        }        else        {// MAW Version 1.17// Previously, the parser would skip over unexpected tokens at the// upper level. Some invalid DTDs would still show up as valid.            throw new DTDParseException(scanner.getUriId(),                        "Unexpected token: "+ token.type.name+"("+token.value+")",                        scanner.getLineNumber(), scanner.getColumn());        }    }    protected void skipUntil(TokenType stopToken)        throws IOException    {        Token token = scanner.get();        while (token.type != stopToken)        {            token = scanner.get();        }    }    protected Token expect(TokenType expected)        throws IOException    {        Token token = scanner.get();        if (token.type != expected)        {            if (token.value == null)            {                throw new DTDParseException(scanner.getUriId(),                            "Expected "+expected.name+" instead of "+token.type.name,                            scanner.getLineNumber(), scanner.getColumn());            }            else            {                throw new DTDParseException(scanner.getUriId(),                            "Expected "+expected.name+                                " instead of "+ token.type.name+"("+token.value+")",                            scanner.getLineNumber(), scanner.getColumn());            }        }        return token;    }    protected void parseElement()        throws IOException    {        Token name = expect(Scanner.IDENTIFIER);        DTDElement element = (DTDElement) dtd.elements.get(name.value);        if (element == null)        {            element = new DTDElement(name.value);            dtd.elements.put(element.name, element);        }        else if (element.content != null)        {// 070501 MAW: Since the ATTLIST tag can also cause an element to be created,// only throw this exception if the element has content defined, which// won't happen when you just create an ATTLIST. Thanks to// Jags Krishnamurthy of Object Edge for pointing out this problem - // originally the parser would let you define an element more than once.            throw new DTDParseException(scanner.getUriId(),                "Found second definition of element: "+name.value,                        scanner.getLineNumber(), scanner.getColumn());        }        dtd.items.addElement(element);        parseContentSpec(scanner, element);        expect(Scanner.GT);    }    protected void parseContentSpec(Scanner scanner, DTDElement element)        throws IOException    {        Token token = scanner.get();        if (token.type == Scanner.IDENTIFIER)        {            if (token.value.equals("EMPTY"))            {                element.content = new DTDEmpty();            }            else if (token.value.equals("ANY"))            {                element.content = new DTDAny();            }            else            {                throw new DTDParseException(scanner.getUriId(),                    "Invalid token in entity content spec "+                        token.value,                        scanner.getLineNumber(), scanner.getColumn());            }        }        else if (token.type == Scanner.LPAREN)        {            token = scanner.peek();            if (token.type == Scanner.IDENTIFIER)            {                if (token.value.equals("#PCDATA"))                {                    parseMixed(element);                }                else                {                    parseChildren(element);                }            }            else if (token.type == Scanner.LPAREN)            {                parseChildren(element);            }        }    }    protected void parseMixed(DTDElement element)        throws IOException    {        // MAW Version 1.19        // Keep track of whether the mixed is #PCDATA only        // Don't allow * after (#PCDATA), but allow after        // (#PCDATA|foo|bar|baz)*        boolean isPcdataOnly = true;        DTDMixed mixed = new DTDMixed();        mixed.add(new DTDPCData());        scanner.get();        element.content = mixed;        for (;;)        {            Token token = scanner.get();            if (token.type == Scanner.RPAREN)            {                token = scanner.peek();                if (token.type == Scanner.ASTERISK)                {                    scanner.get();                    mixed.cardinal = DTDCardinal.ZEROMANY;                }                else                {                    if (!isPcdataOnly)                    {                        throw new DTDParseException(scanner.getUriId(),                                        "Invalid token in Mixed content type, '*' required after (#PCDATA|xx ...): "+                                        token.type.name, scanner.getLineNumber(), scanner.getColumn());                    }                    mixed.cardinal = DTDCardinal.NONE;                }                return;            }            else if (token.type == Scanner.PIPE)            {                token = scanner.get();                mixed.add(new DTDName(token.value));                // MAW Ver. 1.19                isPcdataOnly = false;            }            else            {                throw new DTDParseException(scanner.getUriId(),                                "Invalid token in Mixed content type: "+                                token.type.name, scanner.getLineNumber(), scanner.getColumn());            }        }    }    protected void parseChildren(DTDElement element)        throws IOException    {        DTDContainer choiceSeq = parseChoiceSequence();        Token token = scanner.peek();        choiceSeq.cardinal = parseCardinality();        if (token.type == Scanner.QUES)        {            choiceSeq.cardinal = DTDCardinal.OPTIONAL;        }        else if (token.type == Scanner.ASTERISK)        {            choiceSeq.cardinal = DTDCardinal.ZEROMANY;        }        else if (token.type == Scanner.PLUS)        {            choiceSeq.cardinal = DTDCardinal.ONEMANY;        }        else        {            choiceSeq.cardinal = DTDCardinal.NONE;        }        element.content = choiceSeq;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕亚洲在| 久久精品免费看| 日韩高清在线一区| 成人免费看黄yyy456| 欧美日韩国产高清一区| 欧美国产欧美综合| 日本一不卡视频| 欧美视频自拍偷拍| 国产精品丝袜久久久久久app| 日本最新不卡在线| 欧美亚洲尤物久久| 亚洲人被黑人高潮完整版| 国内精品伊人久久久久av一坑| 欧洲视频一区二区| 日韩一区在线看| 懂色av一区二区三区免费看| 精品国产自在久精品国产| 亚洲成a人v欧美综合天堂下载| av影院午夜一区| 国产精品无人区| 国产曰批免费观看久久久| 日韩一区二区在线观看视频播放| 亚洲在线观看免费| 在线观看一区二区精品视频| 亚洲人成人一区二区在线观看| 成人福利视频在线看| 日本一区二区三区高清不卡| 国产精品1024| 国产欧美一区二区精品秋霞影院| 激情久久久久久久久久久久久久久久| 欧美顶级少妇做爰| 日本女优在线视频一区二区| 欧美一级艳片视频免费观看| 免费成人在线播放| 欧美大片在线观看一区| 久久91精品久久久久久秒播| 精品国产乱码久久久久久牛牛 | 99久久精品国产网站| 国产精品久久久久影院亚瑟| 成人免费不卡视频| 亚洲欧洲精品一区二区精品久久久| 国产99精品视频| 中文字幕制服丝袜一区二区三区| 99re热这里只有精品视频| 中文字幕av一区二区三区| 成人av午夜影院| 一区二区激情小说| 欧美精品乱码久久久久久按摩| 日韩制服丝袜先锋影音| 日韩欧美二区三区| 懂色一区二区三区免费观看| 亚洲精品自拍动漫在线| 欧美日韩在线播放三区| 老司机午夜精品| 国产欧美一区二区三区在线老狼| 国产99精品在线观看| 一区二区免费视频| 日韩免费观看2025年上映的电影| 国产精品一二三在| 一区二区欧美国产| 欧美tk—视频vk| 色综合天天综合色综合av| 五月天久久比比资源色| 久久九九99视频| 91黄色免费网站| 韩国理伦片一区二区三区在线播放| 欧美高清在线一区二区| 欧美亚洲综合在线| 国产成人精品影院| 性感美女极品91精品| 国产三级精品三级| 欧美放荡的少妇| 成人av在线资源网| 美洲天堂一区二卡三卡四卡视频 | 国产午夜精品在线观看| 色噜噜狠狠成人网p站| 另类中文字幕网| 一区二区三区自拍| 国产婷婷色一区二区三区四区| 欧洲人成人精品| 懂色av一区二区夜夜嗨| 蜜桃一区二区三区在线观看| 亚洲视频一二三| 久久先锋影音av鲁色资源网| 欧美性极品少妇| www.在线欧美| 国产精品一级片在线观看| 日本一道高清亚洲日美韩| 亚洲人成在线播放网站岛国| 久久蜜桃av一区精品变态类天堂 | 懂色av中文字幕一区二区三区| 亚洲狠狠爱一区二区三区| 国产精品另类一区| 欧美va亚洲va| 欧美日本国产一区| 日本韩国欧美在线| av中文字幕亚洲| 成人性生交大片免费看中文| 久久国产视频网| 日韩成人伦理电影在线观看| 亚洲综合在线免费观看| 国产精品国产三级国产| 国产视频视频一区| 久久久777精品电影网影网| 日韩美女在线视频| 欧美一区二视频| 欧美一区二区三区视频在线| 欧美高清一级片在线| 欧美视频一区二区三区四区 | 国产成人在线看| 国产综合色视频| 国产在线精品不卡| 精品一区二区三区在线观看 | 综合欧美一区二区三区| 久久久国产精华| 久久久精品天堂| 日本一区二区三区久久久久久久久不| 久久久影视传媒| 日本一区二区三区在线不卡| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 一区二区三区四区蜜桃| 亚洲欧美日韩一区二区| 亚洲精品五月天| 亚洲成人精品影院| 亚洲va国产天堂va久久en| 亚洲福利一区二区| 免费高清视频精品| 国产精品资源在线观看| 国产不卡高清在线观看视频| 成人av电影免费观看| 一本大道综合伊人精品热热| 欧美怡红院视频| 日韩丝袜情趣美女图片| 久久久久久久av麻豆果冻| 国产精品天干天干在观线| 一区二区三区免费观看| 青青草97国产精品免费观看 | 国产一区二区三区视频在线播放| 国产老女人精品毛片久久| 成人av电影在线播放| 在线中文字幕不卡| 日韩一级欧美一级| 国产精品美女视频| 亚洲国产精品视频| 日本道精品一区二区三区| 欧美福利视频导航| 国产午夜精品美女毛片视频| 亚洲色图在线视频| 麻豆精品在线观看| av在线播放一区二区三区| 欧美精品v国产精品v日韩精品| 精品理论电影在线观看 | 97se亚洲国产综合在线| 欧美午夜精品久久久久久超碰| 精品国产一区久久| 一卡二卡欧美日韩| 国内精品自线一区二区三区视频| 99v久久综合狠狠综合久久| 欧美一区二区三区四区五区| 国产精品国产自产拍在线| 日韩电影在线免费看| 99在线精品一区二区三区| 91精品国产综合久久久蜜臀图片| 国产精品人成在线观看免费| 午夜精品久久久| 91蜜桃免费观看视频| 26uuuu精品一区二区| 图片区日韩欧美亚洲| 不卡av电影在线播放| 精品国产a毛片| 亚洲大片精品永久免费| 白白色 亚洲乱淫| 久久综合九色综合97_久久久| 亚洲成人久久影院| 91免费版在线| 国产精品女同一区二区三区| 麻豆精品久久精品色综合| 欧美四级电影网| 亚洲欧美日韩国产成人精品影院| 国产精品一区二区果冻传媒| 欧美一区二区三区在线看| 黑人巨大精品欧美黑白配亚洲| 欧美亚一区二区| 亚洲天堂中文字幕| 国产精品99久久久| 日韩欧美资源站| 日韩国产在线一| 欧美日韩精品一区二区三区蜜桃| 成人免费在线播放视频| 成人三级在线视频| 久久久精品免费网站| 极品少妇xxxx精品少妇偷拍| 制服丝袜av成人在线看| 日韩精品乱码免费| 欧美麻豆精品久久久久久| 亚洲一区二区三区不卡国产欧美| 91色婷婷久久久久合中文| 亚洲欧美国产77777| 91蜜桃婷婷狠狠久久综合9色| 亚洲视频一二三区|