Welcome![Sign In][Sign Up]
Location:
Search - import

Search list

[mpeg mp3mpegedit_v2.2.tar.gz

Description: MPEG-1 video stream editor for Unix systems running X windows. Cut, paste, insert, import and export frames as bitmap files, insert other MPEG-1 video files, apply complex effects such as fades, wipes, and cross fades
Platform: | Size: 336117 | Author: | Hits:

[Internet-Network用Java编写HTML文件分析程序

Description:

Java编写HTML文件分析程序

 一、概述

    

    Web服务器的核心是对Html文件中的各标记(Tag)作出正确的分析,一种编程语言的解释程序也是对源文件中的保留字进行分析再做解释的。实际应用中,我们也经常会碰到需要对某一特定类型文件进行要害字分析的情况,比如,需要将某个HTML文件下载并同时下载与之相关的.gif.class等文件,此时就要求对HTML文件中的标记进行分离,找出所需的文件名及目录。在Java出现以前,类似工作需要对文件中的每个字符进行分析,从中找出所需部分,不仅编程量大,且易出错。笔者在近期的项目中利用Java的输入流类StreamTokenizer进行HTML文件的分析,效果较好。在此,我们要实现从已知的Web页面下载HTML文件,对其进行分析后,下载该页面中包含的HTML文件(假如在Frame中)、图像文件和ClassJava Applet)文件。

    

    二、StreamTokenizer

    

    StreamTokenizer即令牌化输入流的作用是将一个输入流中变成令牌流。令牌流中的令牌实体有三类:单词(即多字符令牌)、单字符令牌和空白(包括JavaC/C++中的说明语句)。

    

    StreamTokenizer类的构造器为: StreamTokenizer(InputStream in)

    

    该类有一些公有实例变量:ttypesvalnval ,分别表示令牌类型、当前字符串值和当前数字值。当我们需要取得令牌(即HTML中的标记)之间的字符时,应访问变量sval。而读向下一个令牌的方法是调用nextToken()。方法nextToken()的返回值是int型,共有四种可能的返回:

    

    StreamTokenizer.TT_NUMBER: 表示读到的令牌是数字,数字的值是double型,可以从实例变量nval中读取。

    

    StreamTokenizer.TT_Word: 表示读到的令牌是非数字的单词(其他字符也在其中),单词可以从实例变量sval中读取。

    

    StreamTokenizer.TT_EOL: 表示读到的令牌是行结束符。

    

    假如已读到流的尽头,则nextToken()返回TT_EOF

    

    开始调用nextToken()之前,要设置输入流的语法表,以便使分析器辨识不同的字符。WhitespaceChars(int low, int hi)方法定义没有意义的字符的范围。WordChars(int low, int hi)方法定义构造单词的字符范围。

    

    三、程序实现

    

    1HtmlTokenizer类的实现

    

    对某个令牌流进行分析之前,首先应对该令牌流的语法表进行设置,在本例中,即是让程序分出哪个单词是HTML的标记。下面给出针对我们需要的HTML标记的令牌流类定义,它是StreamTokenizer的子类:

    

    

    import java.io.*;

    import java.lang.String;

    class HtmlTokenizer extends

    StreamTokenizer {

    //定义各标记,这里的标记仅是本例中必须的,

    可根据需要自行扩充

     static int HTML_TEXT=-1;

     static int HTML_UNKNOWN=-2;

     static int HTML_EOF=-3;

     static int HTML_IMAGE=-4;

     static int HTML_FRAME=-5;

     static int HTML_BACKGROUND=-6;

     static int HTML_APPLET=-7;

    

    boolean outsideTag=true; //判定是否在标记之中

    

     //构造器,定义该令牌流的语法表。

     public HtmlTokenizer(BufferedReader r) {

    super(r);

    this.resetSyntax(); //重置语法表

    this.wordChars(0,255); //令牌范围为全部字符

    this.ordinaryChar('< '); //HTML标记两边的分割符

    this.ordinaryChar('>');

     } //end of constrUCtor

    

     public int nextHtml(){

    int token; //令牌

    try{

    switch(token=this.nextToken()){

    case StreamTokenizer.TT_EOF:

    //假如已读到流的尽头,则返回TT_EOF

    return HTML_EOF;

    case '< ': //进入标记字段

    outsideTag=false;

    return nextHtml();

    case '>': //出标记字段

    outsideTag=true;

    return nextHtml();

    case StreamTokenizer.TT_WORD:

    //若当前令牌为单词,判定是哪个标记

    if (allWhite(sval))

     return nextHtml(); //过滤其中空格

    else if(sval.toUpperCase().indexOf("FRAME")

    !=-1 && !outsideTag) //标记FRAME

     return HTML_FRAME;

    else if(sval.toUpperCase().indexOf("IMG")

    !=-1 && !outsideTag) //标记IMG

     return HTML_IMAGE;

    else if(sval.toUpperCase().indexOf("BACKGROUND")

    !=-1 && !outsideTag) //标记BACKGROUND

     return HTML_BACKGROUND;

    else if(sval.toUpperCase().indexOf("APPLET")

    !=-1 && !outsideTag) //标记APPLET

     return HTML_APPLET;

    default:

    System.out.println ("Unknown tag: "+token);

    return HTML_UNKNOWN;

     } //end of case

    }catch(IOException e){

    System.out.println("Error:"+e.getMessage());}

    return HTML_UNKNOWN;

     } //end of nextHtml

    

    protected boolean allWhite(String s){//过滤所有空格

    //实现略

     }// end of allWhite

    

    } //end of class

    

    以上方法在近期项目中测试通过,操作系统为Windows NT4,编程工具使用Inprise Jbuilder3


Platform: | Size: 1066 | Author: tiberxu | Hits:

[Other Games浩方联机游戏平台源代码

Description:

    本程序利用钩子捕获星际的IPX网络包,通过替换函数入口的方式转换IPX数据为UDP数据包并发到公网服务端,通过公网实现了如同浩方一样的联机游戏功能,其中的钩子dll框架来自网上一强人,本人修改后实现了星际的互连功能。

    procedures for the use of  the hook capture the interstellar IPX packet networks, import substitution function through the data conversion IPX UDP packet to the public network with the server. public networks to achieve the same side as the Gallant online games, which hooks dll framework from the Internet a strongman, I revised achieve interstellar interconnection function.


Platform: | Size: 637800 | Author: Simonz | Hits:

[OtherCalc

Description: 输入含数字的式子(可以用多层括号嵌套),本程序给出结果。-import figures with the formula (Multi-brackets can be nested), this procedure gives results.
Platform: | Size: 39736 | Author: 于是 | Hits:

[AI-NN-PR5个遗传算法源码

Description: (其中已经包含5个源码)所附源程序C或C++代码文件及其可执行文件 Scs.cpp 基本分类算法源程序, 输入数据文件cfile.txt,efile.txt,gfile.txt,pfile.txt ,rfile.txt,tfile.txt Sga.c 基本遗传算法源程序, 输入数据文件input,输出文件output A_life.c 基于遗传算法的人工生命模拟源程序, 输入数据文件world GA_nn.c 基于遗传算法优化神经网络结构源程序,输入数据文件sample Patmat.c 基于遗传算法提取基元图形源程序-(which includes five OSS) attached to C or C source code files and executable files Scs.c pp basic classification algorithm source files, input data files cfile.txt, efile.txt. gfile.txt, pfile.txt, rfile.txt. tfile.txt Sga.c basic genetic algorithm source files, input data files input, output file output A_life.c based on genetic algorithm simulation source Artificial Life, import data files GA_nn.c world based on genetic algorithm optimization neural network structure source, import data files Patmat.c sample extraction based on genetic algorithm-based graphic source yuan
Platform: | Size: 631310 | Author: Thread | Hits:

[WEB Codeeefile

Description: 一个文件发布系统源代码,有输入、显示、文件管理和用户管理界面。-a document publishing system source code, import, display, file management and user interface management.
Platform: | Size: 40793 | Author: freshtea | Hits:

[Hook api钩子函数例子

Description: This the example from Iczelion s Win32 Assembly Tutorial part 24. In order to assemble the example, you have to have ml.exe, link.exe and nmake.exe in your path. If they re not in the path, you will have to edit makefile to include the full path. You ll have to edit the makefile to correct the path to import libraries in your PC. Type nmake in the same directory as makefile and the assembly process will begin. If you don t want to use the makefile, you can manually assemble the example with the commands below: ml /c /coff /Cp mousehook.asm link /SUBSYSTEM:WINDOWS /LIBPATH:c:\\masm32\\lib mousehook.obj
Platform: | Size: 7276 | Author: 风影 | Hits:

[WEB CodeERwinMethodcn

Description: ERWIN绝好的数据库建模工具,可以把数据模型导入数据库如sql server foxpro等这里是方法指南更多内容可以去http://erwin.softwarechn.com/_script/showfull.asp?Board=method&Tabname=erwin-visited excellent database modeling tools, data model can import sql server database such as foxpro so here is how the guide can be more content to http://erwin.softwarechn.com/_script/showfull.asp Board = = erwin methodTabname
Platform: | Size: 248239 | Author: 林星 | Hits:

[WinSock-NDISmyself

Description: 一个有关MIB库操作的JAVA程序,可实现MIB数据的导入和导出.-one of the MIB Java operating procedures, the MIB data import and export.
Platform: | Size: 225921 | Author: 刘忠 | Hits:

[CSharpssqbz

Description: 进口关税查询系统 1.0 件是从事外贸进口业务人员的必备查询资料,该程序为试用版本,您可以任意拷贝、散发,如您对该软件有何意见请及时通知我,如果您对该软件满意,请您注册,我会及时将完整版本用Email发送给您,如果不注册也不会影响您的使用,您可自行添加数据,但不会享受以后软件升级及其他的服务。-import tariffs Inquiry System 1.0 is engaged in foreign trade import business for the required information on the procedures for the trial version, you can copy arbitrary and distributed, if you have any views on the software please inform me in time, if you satisfied with the software, you have registered, I will promptly a complete version of Email sent to you, if you are not registered will not affect your use, you can add their own data, but not receive future software upgrades and other services.
Platform: | Size: 318859 | Author: 左小宾 | Hits:

[GDI-Bitmap屏幕闪烁

Description: 该程序关于BMP位图的导入、显示及相关操作,通过定时器的使用来实现屏幕闪烁-procedures on the bitmap BMP import, display and related operations, through the use of timers to achieve scintillation screen
Platform: | Size: 111896 | Author: 邵文坤 | Hits:

[FlashMXLongWang

Description: This a web mark of my own which is first created by phtotoshop and then import into the flash MX
Platform: | Size: 32264 | Author: 里宾 | Hits:

[GUI Developv7330_XpGridFrame

Description: 主要功能: 1、xpGrid数据控件:根据数据库数据字典定义自动生成DataGrid,可不用写代码即可实现数据的增删改 2、集成的权限控制功能,权限按字段分配,可精确控制字段的读写属性 3、丰富的数据编辑方式:提供按Form方式编辑和按Grid方式编辑两种方式数据编辑界面,对字段的输入方式提供:普通文本框、复选框、密码框、多行文本、下拉列表、引用其它表等多种输入方式 4、数据重构:动态的修改数据字典,通过对数据字典的修改可动态的控制前台界面的显示及输入 5、代码维护:维护下拉列表编辑模式对应的下拉列表内容 6、权限控制:控制用户及角色的功能权限及字段权限 7、简单的应用系统框架-main functions : 1, xpGrid Data Control : According to the database data dictionary definition DataGrid automatically generated, would not have to write code data can be changed to delete the two, the competence of integrated control functions and powers according to the distribution field, the field of precision control read and write attributes 3, rich data editing : Form provided by the editors and by the way Grid two ways to edit data editing interface to the field to provide input : ordinary text box, check box, the password box, and more lines of text, drop-down list, to use other forms of input, such as Mode 4, data reconstruction : Dynamic the revised data dictionary, data dictionaries can dynamically change the future control of display and interface to import 5, code maintenance
Platform: | Size: 501162 | Author: 哲凡 | Hits:

[Mathimatics-Numerical algorithmsCRC_FILE_SRC

Description: 32 bits CRC算法演示,用户可以选择输入一个文件,本工具根据循环雍余校验算法,生成并显示出其32位计算结果。-32 bits CRC algorithm demonstration, a user could choose to import a document, the tools under the revolving Yong I checksum algorithm for generating and demonstrated its 32 results.
Platform: | Size: 27608 | Author: 赵士杰 | Hits:

[OtherC sharp 登陆

Description: c#的登陆入口,是初学者的最基本的数据库的应用程序。-landing import is the most basic beginners database applications.
Platform: | Size: 89793 | Author: king | Hits:

[Othertiyue_caipiao_36_7

Description: 用于查询体育彩票的中奖情况,先导入自己写的体育彩票号码的文本文件,再导入历来中奖的体育彩票号码的文本文件,就可以查询。-inquiries for the sports lottery jackpot, the first to write into their sports lottery number in a text file, then import the sport has always winning lottery number in a text file, it can inquiries.
Platform: | Size: 5205 | Author: | Hits:

[Other文件入(出)库实例

Description: 各种文件导入 和导出SQLserver时列-various file import and export out at the SQL server
Platform: | Size: 46075 | Author: 邓猛 | Hits:

[EditBoxText文本文件导入到SQL数据库

Description: Text文本文件导入到SQL数据库,希望对你能有所帮助-Text import text files to SQL databases, and I hope to help you
Platform: | Size: 6486 | Author: 李华 | Hits:

[Windows DevelopEMS Advanced Data Import VCL version 3.10.1

Description: EMS Advanced Data Import VCL version 3.10.1 一款非常好用的DELPHI导入控件 本站有对应的导出控件(EMS Advanced Data Import VCL version 3.10.1)
Platform: | Size: 29904896 | Author: ChinaOne | Hits:

[Other00004467

Description: import bd simple cod delphi in 5,6,7 firebird
Platform: | Size: 10240 | Author: GDS_SOL | Hits:
« 1 2 3 4 5 6 78 9 10 11 12 ... 50 »

CodeBus www.codebus.net