WO2015154680A1 - 一种文件处理方法、设备和网络系统 - Google Patents

一种文件处理方法、设备和网络系统 Download PDF

Info

Publication number
WO2015154680A1
WO2015154680A1 PCT/CN2015/076112 CN2015076112W WO2015154680A1 WO 2015154680 A1 WO2015154680 A1 WO 2015154680A1 CN 2015076112 W CN2015076112 W CN 2015076112W WO 2015154680 A1 WO2015154680 A1 WO 2015154680A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
content
processing
css
read
Prior art date
Application number
PCT/CN2015/076112
Other languages
English (en)
French (fr)
Inventor
黄欢
Original Assignee
北京奇虎科技有限公司
奇智软件(北京)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京奇虎科技有限公司, 奇智软件(北京)有限公司 filed Critical 北京奇虎科技有限公司
Publication of WO2015154680A1 publication Critical patent/WO2015154680A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present invention relates to the field of the Internet, and in particular, to a file processing method, a file processing device, and a network system for preprocessing a file to be distributed to a server.
  • Internet information is generally stored on servers linked to the network. Users can access these servers to get information.
  • network technology the information acquired by users is becoming more and more abundant. The interaction between the current web page and the user and the readability are also getting better. For example, in a webpage, a large number of webpage related files such as CSS files are used to define how the page is displayed and how it interacts with the user.
  • CSS files As web pages become more complex, the content of CSS files is increasing. For high-traffic websites, after the user obtains the CSS file from the server, the file is parsed on a web client application such as a browser. If the file is not optimized, the client will parse the file. Class files are less efficient. On the other hand, CSS files may be used to request files from the server multiple times because they refer to other files on the server, resulting in a significantly slower file parsing speed.
  • the present invention has been made in order to provide a file processing method, apparatus and network system that overcomes the above problems or at least partially solves or alleviates the above problems.
  • the present invention provides a new solution in an effort to solve or at least alleviate the above problems.
  • a file processing apparatus includes a content reader adapted to read a file content of a file to be processed, an identifier finder adapted to look up a predetermined identifier in the read file content, and an identification processor adapted to be based on the standard a predetermined identifier found by the finder, a process of performing an operation instruction corresponding to the predetermined identifier on the read file content; and an output device adapted to output the processed file content.
  • a file processing method adapted to be executed in a file processing apparatus according to the present invention, and comprising the steps of: reading a file content of a file to be processed; and reading the file in the file Finding a predetermined identifier in the content; performing processing of an operation instruction corresponding to the predetermined identifier on the read file content according to the found predetermined identifier; and outputting the processed file content.
  • a network system comprising a server, a plurality of clients communicating with a server via a network; and a file providing device including the file processing device according to the present invention, wherein the file providing device The file is coupled to the server, and the file processed by the file processing device is transferred to the server and stored therein to be downloaded and processed by any of the plurality of clients.
  • a computer program comprising computer readable code, when the computer readable code is run on a computing device, causing the computing device to perform according to an aspect of the invention File processing method.
  • a computer readable medium storing a computer program provided by still another aspect of the present invention is provided.
  • various pre-processing optimizations can be performed before a webpage related file such as a CSS file is uploaded to the server for the user to download and parse from the client, for example, multilingual text can be processed in advance. , thereby avoiding the need for the client to parse non-standard language content; the other texts referenced may be merged into the webpage related text in advance, thereby avoiding multiple server requests from the client; the useless text in the webpage related text may be deleted in advance, thereby Reduce the size of web-related text, save traffic, and more.
  • FIG. 1 shows a schematic diagram of a network system in accordance with one embodiment of the present invention
  • FIG. 2 shows a schematic diagram of a file processing device in accordance with one embodiment of the present invention
  • FIG. 3 shows a flow chart of a file processing method according to an embodiment of the present invention
  • Figure 4 is a schematic block diagram showing a computing device for performing a file processing method in accordance with the present invention
  • Fig. 5 schematically shows a storage unit for holding or carrying program code implementing a file processing method according to the present invention.
  • FIG. 1 shows a schematic diagram of a network system 100 in accordance with one embodiment of the present invention.
  • network system 100 includes a plurality of clients 110, 120, and 130, a server 140 that provides network information (e.g., web pages) to those clients. These devices communicate with each other via the internet.
  • network information e.g., web pages
  • clients 110-130 may be any device in the art that can present network information (eg, web pages and associated files (eg, CSS files, JS files, multimedia files, etc.)) acquired from server 140, including but Not limited to desktop computers, notebook computers, personal digital assistants, smart mobile terminals, tablets, and the like.
  • the client 110-130 typically runs a modern operating system that utilizes the operating system to manage hardware resources in the client.
  • a web browser is typically run on the client 110 for presenting web pages retrieved from the server 140 and associated data (eg, images, audio and video referenced in the web pages, etc.).
  • Server 140 returns the requested network information to client 110 at the request of client 110.
  • Network information is typically web pages and various files referenced in the page, such as image files, multimedia files such as audio and/or video files, and web page related files such as CSS files and JS files.
  • the client 110 after parsing and presenting the information in the webpage file, will then download the file referenced in the webpage file from the server 140, if the files are still Referring to further other files, client 110 will continue to request downloading of these files from server 140.
  • a file providing device 150 is further included.
  • the file providing device 150 pre-processes various network related files to be uploaded to the server 140.
  • the webpage and its related files can be edited, the rendering effect of the webpage is previewed on the device 150, etc., and then the processed file of the file providing device 150 is transmitted to the server 140 and stored therein, so as to be The client downloads the file from server 140.
  • the file providing device 200 is further included in the file providing device 150.
  • the file processing device 200 preprocesses web page related files (for example, CSS files, etc.) edited in the file providing device 150. Specifically, the file processing device 200 preprocesses the webpage related files before uploading them in the server 140, thereby optimizing the contents of the files, and transmitting the optimized webpage related files to the server 140, Thus, when the client 110 requests a webpage from the server 140, the webpage 110 and the optimized related files are retrieved from the server 140, and the content of the webpages is presented on the client.
  • web page related files for example, CSS files, etc.
  • FIG. 2 shows a schematic diagram of a file processing device 200 in accordance with one embodiment of the present invention.
  • the file processing device 200 includes a content reader 210, an identification finder 220, an identification processor 230, and an output device 240.
  • the file processing device 200 will be initiated by a user of the file providing device 150 in which the file processing device 200 resides to process various web page related files that the user has prepared.
  • the user of the file providing device 150 has edited the web page and is ready to publish the web page and associated content for retrieval by the client 110 from the server 140 and for presentation on the browser of the client 110.
  • the user of the file providing device 150 activates the file processing device 200 to perform optimal pre-processing on various web page related files.
  • the user usually specifies the file directory to be preprocessed.
  • the web page related file may be a related file such as a CSS file that is invoked by the web page to help present the web content at the client and/or to enhance interaction with the user at the client.
  • These files conform to the HTML standard and are widely used in HTML. Other files other than these files will also be referenced in these web page related files.
  • a web page related file is a CSS file
  • a fragment of the CSS file is shown below:
  • .game.show_list ⁇ float:left;height:520px;margin-left:3px;width:230px;background-color:#e7ffe6;border:1px solid#dbf2da;border-radius:5px; ⁇
  • the file processing device 200 processes the files in the user-specified directory one by one, such as a file.
  • the processing device 200 can find all webpage related files under the directory and process them one by one. For example, the file processing device 200 searches for files with the file name css in the directory and processes them one by one.
  • the content reader 210 reads the file contents of a web page related file.
  • the content reader 210 can read the file contents of the web page related file from the mass storage such as a hard disk into the cache for subsequent processing.
  • the content reader 210 may even analyze the file content, for example, using an HTML engine to derive an organizational structure of the content in the file.
  • a tag (tag) and a corresponding value (value) of each CSS can be obtained, for example, an indicator starting with @ and the content following it can be obtained.
  • the content can be directly read out and cached.
  • the identity finder 220 then analyzes the read file content to find various predetermined identities in the file content and content corresponding to the identities.
  • the webpage related file is a CSS file
  • the CSS instruction with the predetermined identifier is “@”
  • the identifier finder 220 searches for each CSS instruction in the read file content, and searches for each CSS instruction. Instruction content.
  • the identification finder 220 can traverse in the organizational structure to find the corresponding CSS instructions and corresponding content. It should be noted that the present invention is not limited to the specific implementation of the identification finder 220, and all manners in which the predetermined identification and corresponding content can be looked up from the contents of the read file are within the scope of the present invention.
  • the identity finder 220 can find multiple CSS instructions, such as @charset, @import, @media, etc., and also find the corresponding instruction content.
  • the instruction content corresponding to the @charset instruction is "utf8”
  • the instruction content corresponding to @import is the CSS file of each application
  • the content corresponding to @media is the setting of the printer, and the like.
  • the identification processor 230 processes the CSS file based on the instruction content corresponding to the CSS instruction according to the respective CSS instructions, so that the CSS content can be subsequently more efficiently used by the client. End 110 acquires and parses and processes on the client.
  • the identification processor 230 will adopt different processing methods according to different CSS instructions.
  • the identification processor 230 includes an encoding processor 232.
  • the identification processor 230 employs the encoding processor 232 to process the CSS instruction.
  • the encoding processor 232 determines the instruction content of the @charset instruction, and then reads the file content according to the encoding method defined by the @charset instruction content. All non-English characters, and convert these non-English characters into unicode (Unicode) encoding.
  • the encoding processor 232 may modify the instruction content of the @charset instruction to "unicode". Since the browser will process the contents of the CSS file by default in a unicode manner, the encoding processor 232 can even delete the instruction, thereby reducing the size of the CSS file.
  • the encoding processor 232 converts it to "0x6c49" and "0x5b57". In this way, when the client 110 acquires the CSS file and parses its content, it does not need to perform the code conversion again, and directly reads the unicode content, thereby saving the time for the client to process the CSS.
  • the identification processor 230 includes a file import processor 234.
  • the identification processor 230 employs the file import processor 234 to process the CSS instruction.
  • the file import processor 234 determines the instruction content of the @import instruction, and then reads the file content of the CSS file from the file providing device 150 according to the CSS file location specified by the instruction content, and inserts it into the content read by the content reader 210.
  • the content of each CSS generally does not have a problem of sequence.
  • the file import processor 234 reads the contents of the file indicated by the @import instruction and inserts it into the content read.
  • the fetcher 210 reads the end of the content. Subsequently, the file import processor 234 deletes the corresponding @import command.
  • the identifier finder 220 recognizes that the file import instruction indicates that the file to be imported is top_nav.header.footer.css, and then the file import processor 230 reads the content of the file top_nav.header.footer.css and reads The fetched content is added to the end of the content read by the content reader 210.
  • the identity processor 230 also includes a default processor 236.
  • the identification processor 230 is when the CSS instruction to be processed by the identification processor is another instruction symbol beginning with @
  • the default processor 236 is employed to process these instructions. Since other instructions starting with @ have no effect on the rendering of the web page when parsing the CSS, in order to improve the processing speed of the CSS file at the client 110, these @instructors can be used by the default processor 236 and correspondingly. The contents of the instruction are deleted, so that the client does not need to parse these unrelated @instructors after obtaining the CSS file, and improve the processing efficiency.
  • the identity processor 230 can invoke the default processor 236 to delete the instruction in the content read by the content reader 210 and the associated Instruction content. In this way, when the client 110 parses the processed CSS file, there is no default processing instruction such as @media in the file, so that no additional processing is required for the instruction, thereby reducing the client 110 parsing the CSS file. time.
  • the output device 240 reads the content of the processed webpage related file and outputs it to the outside of the file processing apparatus 200.
  • the output device 240 may directly transfer the processed webpage related file to the server 140, or may be stored locally in the file providing device 150, and wait for all the webpage related file processing to be completed, and then uniformly transmitted by the file providing device 150 to The server 140 is also stored.
  • the file processing device 200 further includes a content compression device 250.
  • the content compression device 250 may perform compression processing on the processed web page related file before the output device 240 outputs the web page related file. Since the browser at the client 110 supports receiving and processing the compressed file, the webpage related file can be compressed and stored in the server 140, and the client 110 can directly obtain the compressed file for processing. Further saving network bandwidth consumption between the client and the server.
  • the content compression device 250 can also perform some optimization processing, for example, deleting invalid characters such as carriage returns, spaces, and the like in the webpage related files, so that the size of the webpage related files is smaller.
  • some optimization processing for example, deleting invalid characters such as carriage returns, spaces, and the like in the webpage related files, so that the size of the webpage related files is smaller.
  • various pre-processing optimizations can be performed before a web page related file such as a CSS file is uploaded to the server 140 for the user to download and parse from the client 110, for example, it can be pre-multiple
  • the language text is processed, thereby avoiding the client 110 needing to parse the non-standard language content; the other texts referenced may be merged into the webpage related text in advance, thereby avoiding multiple server requests of the client; the webpage related text may be deleted in advance Useless text, which reduces the size of web-related text, saves traffic, and more.
  • the file processing device 200 enables the client 110 to parse and process various web page related files more efficiently by pre-optimizing processing of web page related files such as CSS file instructions.
  • FIG. 3 shows a flow diagram of a file processing method 300 in accordance with one embodiment of the present invention.
  • the method is adapted to be executed in the file providing device 150 shown in FIG. 1, particularly the computing device 200 shown in FIG. 2, to publish web page related files to the server 140.
  • method 300 will be invoked by a user of file providing device 150 to process various web page related files that the user has prepared.
  • the user of the file providing device 150 has written the web page related files and is ready to publish the files for retrieval by the client 110 from the server 140 and presented on the browser of the client 110.
  • the user of the file providing device 150 will invoke the method 300 to perform pre-processing optimization on various web page related files.
  • the user usually specifies the file directory to be preprocessed.
  • the webpage related file may be a page related file such as a CSS file that is invoked by the webpage to help present webpage content on the client and/or to enhance interaction with the user at the client.
  • These files conform to the HTML standard and are widely used in HTML.
  • Other webpage related files will also be referenced in these webpage related files.
  • webpage related files such as CSS have been given in the above description in conjunction with FIG. 2, and are not described herein again.
  • the method is suitable for processing files in a user-specified directory one by one. For example, this method will find all the files in the directory with the file name css and process them one by one.
  • step S310 the file content of a web page related file is read.
  • the file content of the webpage related file may be read from the mass storage such as a hard disk into the cache for subsequent processing.
  • the file content can even be analyzed, for example, using an HTML engine to obtain an organizational structure of the content in the file.
  • a tag (tag) and a corresponding value (value) of each CSS can be obtained.
  • the content can be directly read out Come and cache.
  • step S320 the contents of the file read in step S310 are analyzed to find various predetermined identifiers in the file content and contents corresponding to the identifiers.
  • the webpage related file is a CSS file
  • the CSS instruction predetermined as "@" is started, and in step S320, each CSS instruction is searched in the read file content, and each CSS instruction is searched for. Corresponding instruction content.
  • traversal may be performed in the organizational structure to find the corresponding CSS instruction and corresponding content. It should be noted that the present invention is not limited to the specific implementation of step S320, and all manners of finding a predetermined identifier and corresponding content from the contents of the read file are within the scope of the present invention.
  • a plurality of CSS instructions such as @charset, @import, @media, etc.
  • the instruction content corresponding to the @charset instruction is "utf8”
  • the instruction content corresponding to @import is the CSS file of each application
  • the content corresponding to @media is the setting of the printer, and the like.
  • step S330 the CSS file is processed based on the instruction content corresponding to the CSS instruction according to each CSS instruction, so that the CSS content can be subsequently more efficiently used by the client.
  • End 110 acquires and parses and processes on the client.
  • Step S330 adopts different processing methods according to different CSS instructions.
  • step S330 when the CSS instruction to be processed is an encoding processing instruction symbol (ie, @charset), in step S330, the instruction content of the @charset instruction is determined, and then the encoding method according to the content definition of the @charset instruction is read. Take all non-English characters in the file content, and convert these non-English characters into unicode (Unicode) encoding.
  • the instruction content of the @charset instruction may be modified to "unicode". Since the browser processes the content of the CSS file by default in a unicode manner, step S330 can even delete the instruction, thereby reducing the size of the CSS file.
  • step S330 converts it to "0x6c49" and "0x5b57".
  • the client 110 acquires the CSS file and parses its content, it does not need to perform the code conversion again, and directly reads the unicode content, thereby saving the time for the client to process the CSS.
  • step S330 when the CSS instruction to be processed in step S330 is a file import processing instruction symbol (ie, @import), the instruction content of the @import instruction is determined, The file content of the CSS file is then read from the file providing device 150 according to the CSS file location specified by the instruction content, and inserted into the content read in step S310. Since each CSS usually defines the processing and presentation manner of different elements, the content of each CSS generally does not have a problem of the order, so in step S330, the file content indicated by the @import instruction is read, and the process proceeds to step S310. At the end of the content being read. Subsequently, in step S330, the corresponding @import instruction is deleted.
  • the corresponding @import instruction is deleted.
  • Step S330 recognizes that the file import instruction indicates that the file to be imported is top_nav.header.footer.css, then reads the content of the file top_nav.header.footer.css, and adds the read content to step S310. At the end of the content being read.
  • the further other CSS files referenced by the CSS file can be merged into one CSS file.
  • the client 110 obtains the CSS file, it does not need to parse the @import command and then go to the server 140 to obtain further CSS files, thereby reducing the number of file download requests between the client 110 and the server 140, and speeding up The speed at which the client 110 parses the CSS file.
  • the CSS instruction to be processed in step S330 is another instruction symbol starting with @
  • the instruction starting with @ does not contribute to the presentation of the web page when parsing the CSS
  • the @instructor and the corresponding instruction content may be deleted in step S330, so that the client does not need to parse the unrelated @ instruction after obtaining the CSS file. Symbol and improve processing efficiency.
  • step S330 the instruction and the associated instruction content in the content read in step S310 are deleted.
  • the default processing instructions such as @media do not require additional processing of these instructions, thereby reducing the time that client 110 parses CSS files.
  • the content of the processed web page related file is read in step S340 and output to the outside.
  • the processed webpage related file may be directly transferred to the server 140, or may be stored locally in the file providing device 150, and after all the webpage related file processing is completed, it is uniformly transmitted by the file providing apparatus 150 to the server 140. Store.
  • the file processing method 300 may further include step S350.
  • Step S350 may perform compression processing on the processed webpage related file before outputting the webpage related file in step S340. Since the browser at the client 110 supports receiving and processing the compressed file, the webpage related file can be compressed and stored in the server 140, and the client 110 can directly obtain the compressed file for processing. Further saving network bandwidth consumption between the client and the server.
  • step S350 some optimization processing may be performed in step S350. For example, invalid characters such as carriage returns and spaces in the webpage related file may be deleted, so that the size of the webpage related file is smaller. When the number of clients 110 is large, a small modification of the file size of the webpage can save a lot of network bandwidth.
  • various pre-processing optimizations can be performed before uploading a web page related file such as a CSS file to the server 140 for the user to download and parse from the client 110, for example,
  • the language text is processed, thereby avoiding the client 110 needing to parse the non-standard language content; the other texts referenced may be merged into the webpage related text in advance, thereby avoiding multiple server requests of the client; the webpage related text may be deleted in advance Useless text, which reduces the size of web-related text, saves traffic, and more.
  • the file processing device 200 enables the client 110 to parse and process various web page related files more efficiently by pre-optimizing processing of web page related files such as CSS file instructions.
  • modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment.
  • the modules or units or components of the embodiments may be combined into one module or unit or component, and further they may be divided into a plurality of sub-modules or sub-units or sub-components.
  • any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed, or All processes or units of the device are combined.
  • Each feature disclosed in this specification (including the accompanying claims, the abstract and the drawings) may be replaced by alternative features that provide the same, equivalent or similar purpose.
  • the various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
  • a microprocessor or digital signal processor may be used in practice to implement some or all of some or all of the components of the file processing device and/or network system in accordance with embodiments of the present invention.
  • the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
  • a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
  • Figure 4 illustrates a computing device that can implement a file processing method in accordance with the present invention.
  • the computing device conventionally includes a processor 410 and a computer program product or computer readable medium in the form of a memory 420.
  • Memory 420 can be, for example, flash memory, EEPROM (electrically erasable programmable Electronic memory such as read only memory), EPROM, hard disk or ROM.
  • Memory 420 has a memory space 430 for program code 431 for performing any of the method steps described above.
  • storage space 430 for program code may include various program code 431 for implementing various steps in the above methods, respectively.
  • the program code can be read from or written to one or more computer program products.
  • These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. Such computer program products are typically portable or fixed storage units as described with reference to FIG.
  • the storage unit may have storage segments, storage spaces, and the like that are similarly arranged to memory 420 in the computing device of FIG.
  • the program code can be compressed, for example, in an appropriate form.
  • the storage unit includes computer readable code 431', ie, code readable by a processor, such as 410, that when executed by a computing device causes the computing device to perform each of the methods described above step.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

一种文件处理方法、设备和网络系统。文件处理设备包括:内容读取器(210),适于读取要处理文件的文件内容;标识查找器(220),适于在所读取的文件内容中查找预定标识;标识处理器(230),适于根据标识查找器查找到的预定标识,对所读取的文件内容进行与所述预定标识对应的操作指令的处理;以及输出装置(240),适于输出经处理的文件内容。

Description

一种文件处理方法、设备和网络系统 技术领域
本发明涉及互联网领域,尤其涉及对要发布到服务器的文件进行预处理的文件处理方法、文件处理设备和网络系统。
背景技术
随着互联网络的发展,越来越多的用户通过互联网来获取信息,互联网的信息一般存储在链接到网络中的服务器上。用户可以访问这些服务器来获取信息。随着网络技术的发展,用户获取的信息也越来越丰富。现在的网络页面与用户的交互性以及可阅读性也越来也好。例如,在网页中,会采用大量的CSS文件等网页相关文件来定义页面的显示方式以及与用户的交互方式等。
随着网页日益复杂,CSS文件的内容也越来越多。对于高访问量的网站来说,用户从服务器获取了CSS文件之后,会在诸如浏览器之类的网络客户端应用上解析该文件,如果该文件未被优化,一方面会导致客户端解析这类文件的效率较低,另一方面也可能会由于CSS文件引用了在服务器上的其它文件而导致多次从服务器请求文件,导致文件解析速度显著降低。
因此,需要一种能够在将诸如CSS文件之类的网页相关文件在上传到服务器由用户下载之前进行预处理优化以便用户可以高效地从服务器下载这类文件并进行解析的新方案。
发明内容
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决或者减缓上述问题的文件处理方法、设备和网络系统。
为此,本发明提供一种新的方案以力图解决或者至少缓解上面存在的问题。
根据本发明的一个方面,提供了一种文件处理设备。该文件处理设备包括内容读取器,适于读取要处理文件的文件内容;标识查找器,适于在所读取的文件内容中查找预定标识;标识处理器,适于根据标 识查找器查找到的预定标识,对所读取的文件内容进行与所述预定标识对应的操作指令的处理;以及输出装置,适于输出经处理的文件内容。
根据本发明的另一个方面,提供了一种文件处理方法,该方法适于在根据本发明的文件处理设备中执行,并且包括步骤:读取要处理文件的文件内容;在所读取的文件内容中查找预定标识;根据查找到的预定标识,对所读取的文件内容进行与所述预定标识对应的操作指令的处理;以及输出经处理的文件内容。
根据本发明的还一个方面,提供了一种网络系统,该系统包括服务器,多个经由网络与服务器进行通信的客户端;以及包括根据本发明的文件处理设备的文件提供设备,其中文件提供设备耦接到服务器,将文件处理设备处理后的文件传输到服务器并存储其中,以便由多个客户端中的任一个来下载该文件并进行处理。
根据本发明的又一个方面,提供了一种计算机程序,其包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行根据本发明一个方面所述的文件处理方法。
根据本发明的再一个方面,提供了一种计算机可读介质,其中存储了本发明的又一个方面提供的计算机程序。
根据本发明的文件处理方式,可以在将诸如CSS文件之类的网页相关文件上传在服务器以供用户从客户端下载并解析之前,进行各种预处理优化,例如可以预先对多语言文本进行处理,从而避免了客户端需要解析非标准的语言内容;可以预先将引用的其它文本合并到网页相关文本中,从而避免了客户端的多次服务器请求;可以预先删除网页相关文本中的无用文本,从而减少了网页相关文本的尺寸,节省了流量等。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
附图说明
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处 对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:
图1示出了根据本发明一个实施例的网络系统的示意图;
图2示出了根据本发明一个实施例的文件处理设备的示意图;
图3示出了根据本发明一个实施例的文件处理方法的流程图;
图4示意性地示出了用于执行根据本发明的文件处理方法的计算设备的框图;以及
图5示意性地示出了用于保持或者携带实现根据本发明的文件处理方法的程序代码的存储单元。
具体实施方式
下面结合附图和具体的实施方式对本发明作进一步的描述。
图1示出了根据本发明一个实施例的网络系统100的示意图。如图1所示,网络系统100包括多个客户端110,120和130、为这些客户端提供网络信息(例如网页)的服务器140。这些设备经由互联网络而相互通信。
在下文中将以客户端110为例来指示所有的客户端。在本发明中,客户端110-130可以是本领域任何可以呈现从服务器140获取的网络信息(例如网页以及相关联的文件(例如CSS文件,JS文件和多媒体文件等))的设备,包括但不限于桌面型计算机、笔记本式计算机、个人数字助理、智能移动终端、平板电脑等。客户端110-130中通常运行现代的操作系统,利用操作系统来管理客户端中的硬件资源。客户端110上通常运行有网页浏览器,用于呈现从服务器140获取的网页以及相关联的数据(例如网页中引用的图像,音频和视频等)。
服务器140应客户端110的请求而将所请求的网络信息返回客户端110。网络信息通常为网页页面以及在页面中引用的各种文件,例如图像文件,音频和/或视频文件等多媒体文件,以及诸如CSS文件和JS文件之类的网页相关文件。在实践中,当客户端110从服务器140请求了网页文件之后,客户端110在解析并呈现该网页文件中的信息时,会随后从服务器140下载网页文件中所引用的文件,如果这些文件还引用了进一步的其它文件,则客户端110会继续从服务器140请求下载这些文件。
另外,在网络系统100中,还包括文件提供设备150。文件提供设备150对要上传到服务器140的各种网络相关文件进行预先处理。例如在文件提供设备150中,可以对网页及其相关文件进行编辑,在设备150上预览网页的呈现效果等,随后将文件提供设备150处理完成后的文件传输到服务器140并存储其中,以便由客户端从服务器140下载该文件。
文件提供设备150中还包括文件处理设备200。文件处理设备200会对文件提供设备150中编辑好的网页相关文件(例如,CSS文件等)进行预处理。具体而言,文件处理设备200会在将网页相关文件上传在服务器140中之前对这些文件进行预处理,从而对这些文件的内容进行优化,并且将经过优化的网页相关文件传输到服务器140中,这样客户端110在向服务器140请求网页时,会从服务器140获取网页及经过优化的相关文件,且在客户端呈现这些网页的内容。
图2示出了根据本发明一个实施例的文件处理设备200的示意图。如图2所示,文件处理设备200包括内容读取器210、标识查找器220、标识处理器230和输出装置240。
一般而言,文件处理设备200会由文件处理设备200驻留其中的文件提供设备150的用户启动来处理该用户已经准备好的各种网页相关文件。例如文件提供设备150的用户已经编辑好网页,并准备将这些网页以及相关联的内容发布出去以便由客户端110来从服务器140获取并呈现在客户端110的浏览器上。随后,文件提供设备150的用户就会启动文件处理设备200来对各种网页相关文件进行优化预处理。用户通常会指定要进行预处理的文件目录。
网页相关文件可以是诸如CSS文件、会由网页调用来帮助在客户端来呈现网页内容和/或提高与客户端处的用户之间的交互的相关文件。这些文件符合HTML标准,并且在HTML中被广泛使用。这些网页相关文件中,还会引用在这些文件之外的其它文件。
例如,当网页相关文件为CSS文件时,下文中示出了CSS文件的一个片段:
@charset″utf-8″;
/*组件css*/
@import url(′top_nav.header.footer.css′);
@import url(′dialog.css′);
@import url(′upper_my_info.css′);/*我的签名发言区域*/
@import url(′myspace_menu.css′);
@import url(′upper_u_info.css′);
@import url(′space_menu.css′);
@import url(′app_menu.css′);
@import url(′clm.css′);/*成就徽章/最近正在玩/热门话题/感兴趣的人/我的好友/最近来访*/
@import url(′wb_content.css′);/*微博内容*/
@import url(′manage_subnav.css′);/*子导航*/
@media screen{BODY{font-size:12pt;}}
//设置打印机用字体尺寸
@media print{
@import″print.css″
BODY{font-size:8pt;}
}
.game{margin:10px 25px 0 25px;border:solid 1px#c9edc3;border-radius:5px;}
.game.show_gamebox{width:960px;margin:0 auto;clear:both;padding:10px 0 15px;overflow:hidden;border-bottom:solid 0#D8D8D8;}
.game.show_game{border:2px solid black;float:left;height:520px;width:700px;margin-left:4px;}
.game.show_list{float:left;height:520px;margin-left:3px;width:230px;background-color:#e7ffe6;border:1px solid#dbf2da;border-radius:5px;}
.game.show_list ul{width:220px;height:470px;overflow:hidden;margin:30px 5px 0;}
.game.blues{color:#125A9C;}
.game.red{color:red;}
在上面的示例中,可以看出,在CSS文件,存在以@开头的各种处理指示符,例如@charset指定CSS文件中的样式表使用的字符集,@import指定要引入到该CSS样式表中的其他样式表的位置,以及@media指定媒体类型等。
文件处理设备200逐个地对用户指定目录下的文件进行处理,例如文件 处理设备200可以查找到在该目录下的所有网页相关文件,并逐个进行处理。例如,文件处理设备200会查找该目录下所有文件后缀名为css的文件,并逐个进行处理。
内容读取器210会读取一个网页相关文件的文件内容。例如,内容读取器210可以将网页相关文件的文件内容从诸如硬盘之类的大容量存储器读取到缓存中,以便于后续处理。在一个实施例中,内容读取器210甚至可以例如利用HTML引擎对该文件内容分析,从而得到该文件中内容的组织结构。例如就CSS而言,可以获得每个CSS的标签(tag)和对应的值(value),例如可以获得每个以@开头的指示符以及其后面的内容。当然,根据本发明的另一个实施例,可以直接将内容读取出来并进行缓存即可。
标识查找器220随后对所读取的文件内容进行分析,以查找出该文件内容中的各种预定标识以及与这些标识对应的内容。根据本发明的一个实施例,网页相关文件为CSS文件,而预定标识为“@”开头的CSS指令,标识查找器220在所读取的文件内容中查找各个CSS指令,并查找各个CSS指令对应的指令内容。根据本发明的又一个实施例,当内容读取器210获得了文件的组织结构时,则标识查找器220可以在该组织结构中进行遍历以查找相应的CSS指令和对应内容。应当注意的是,本发明不受限于标识查找器220的具体实现方式,所有可以从所读取的文件内容中查找预定标识以及对应内容的方式都在本发明的保护范围之内。
例如,在上面的示例中,标识查找器220可以查找到多个CSS指令,例如@charset、@import以及@media等,并且还查找到对应的指令内容。例如,对应于@charset指令的指令内容为“utf8”,而对应于@import的指令内容为各个应用的CSS文件,对应于@media的内容为打印机的设置等。
在标识查找器220查找到各个CSS指令之后,标识处理器230根据各个CSS指令,基于与该CSS指令相对应的指令内容来对CSS文件进行处理,从而使得该CSS内容后续可以更高效地由客户端110获取并在客户端解析和处理。标识处理器230会根据CSS指令的不同,而采用不同的处理方式。
根据本发明的一个实施例,标识处理器230包括编码处理器232。当标识处理器要处理的CSS指令为编码处理指令符(即@charset)时,标识处理器230采用编码处理器232来处理该CSS指令。编码处理器232确定@charset指令的指令内容,然后根据@charset指令内容定义的编码方式读取文件内容 中所有的非英文字符,并且将这些非英文字符转换为unicode(统一码)编码方式编码后的内容。另外可选地,编码处理器232可以将@charset指令的指令内容修改为“unicode”。由于浏览器缺省会以unicode的方式来处理CSS文件的内容,因此编码处理器232甚至可以删除该指令,从而减少CSS文件的大小。
例如,当CSS内容中的非英文字符是“汉字”时,编码处理器232会将其转换为“0x6c49”和“0x5b57”。这样,当客户端110获取该CSS文件并解析其内容时,就不需要再次进行编码转换,而直接读取unicode的内容,从而节省了客户端处理CSS的时间。
根据本发明的还有一个实施例,标识处理器230包括文件导入处理器234。当标识处理器要处理的CSS指令为文件导入处理指令符(即@import)时,标识处理器230采用文件导入处理器234来处理该CSS指令。文件导入处理器234确定@import指令的指令内容,然后根据该指令内容指定的CSS文件位置从文件提供设备150中读取该CSS文件的文件内容,并插入到内容读取器210所读取的内容中。由于各个CSS通常会定义不同元素的处理和呈现方式,各个CSS的内容一般不存在前后顺序的问题,因此,文件导入处理器234会读取@import指令所指示的文件内容,并且插入到内容读取器210读取内容的结尾处。随后,文件导入处理器234会删除相应的@import指令。
例如,在上面的示例中,存在一条文件导入指令:
@import url(′top_nav.header.footer.css′);
标识查找器220会识别出该文件导入指令指示要导入的文件为top_nav.header.footer.css,随后文件导入处理器230会读取该文件top_nav.header.footer.css的内容,并且将所读取的内容添加到内容读取器210所读取的内容的末尾处。
通过文件导出处理器234的处理,可以将CSS文件所引用的更进一步的其他CSS文件合并到一个CSS文件中。当客户端110获取该CSS文件之后,不需要对@import指令进行解析而再去服务器140获取更进一步的其他CSS文件,从而减少了在客户端110和服务器140之间的文件下载请求次数,加快了客户端110解析CSS文件的速度。
根据本发明的一个实施例,标识处理器230还包括缺省处理器236。当标识处理器要处理的CSS指令为其它以@开头的指令符时,标识处理器230 采用缺省处理器236来处理这些指令。由于在对CSS进行解析时,其它以@开头的指令对于网页的呈现并没有作用,为了在客户端110处提高对CSS文件的处理速度,可以由缺省处理器236将这些@指令符以及相应的指令内容删除掉,从而使得客户端在获得CSS文件之后,不用解析这些无关的@指令符,并提高处理效率。
例如,在上面的示例中,存在@media指令及其相关内容:
@media screen{BODY{font-size:12pt;}}
//设置打印机用字体尺寸
@media print{
@import″print.css″
BODY{font-size:8pt;}
}
由于@media指令并不会对在客户端呈现网页内容有所影响,因此,标识处理器230可以调用缺省处理器236删除内容读取器210所读取的内容中的该指令以及相关联的指令内容。这样,当客户端110解析经过处理的CSS文件时,该文件中不存在诸如@media之类的缺省处理指令,从而也不用对这些指令进行额外处理,从而减少了客户端110解析CSS文件的时间。
在标识处理器230完成处理之后,输出装置240会读取经过处理的网页相关文件的内容,并输出到文件处理设备200的外部。例如,输出装置240可以直接将经过处理的网页相关文件传输到服务器140中,也可以在文件提供设备150的本地存储,并等待所有的网页相关文件处理完成之后,统一由文件提供设备150传输到服务器140并进行存储。
可选地,文件处理设备200还包括内容压缩装置250。内容压缩装置250可以在输出装置240输出网页相关文件之前,对经过处理的网页相关文件进行压缩处理。由于现在客户端110处的浏览器都支持接收压缩的文件并进行处理,所以,可以将网页相关文件进行压缩并存储到服务器140中,客户端110可以直接获取经过压缩的文件来处理,这样可以进一步节省在客户端和服务器之间的网络带宽消耗。
另外,内容压缩装置250还可以进行一些优化处理,例如可以删除网页相关文件中多余的回车、空格等无效字符,使得网页相关文件的大小更小。当客户端110的数量巨大时,网页相关文件尺寸的少许修改就可以节省大量 的网络带宽。
利用根据本发明的文件处理设备200,可以在将诸如CSS文件之类的网页相关文件上传在服务器140以供用户从客户端110下载并解析之前,进行各种预处理优化,例如可以预先对多语言文本进行处理,从而避免了客户端110需要解析非标准的语言内容;可以预先将引用的其它文本合并到网页相关文本中,从而避免了客户端的多次服务器请求;可以预先删除网页相关文本中的无用文本,从而减少了网页相关文本的尺寸,节省了流量等。文件处理设备200通过对诸如CSS文件指令的网页相关文件进行预先优化处理,从而使得客户端110可以更高效地解析并处理各种网页相关文件。
图3示出了根据本发明一个实施例的文件处理方法300的流程图。方法适于在图1所示的文件提供设备150,尤其是图2所示的计算设备200中执行,以便将网页相关文件发布到服务器140中。
一般而言,方法300会由文件提供设备150的用户调用来处理该用户已经准备好的各种网页相关文件。例如文件提供设备150的用户已经编写好网页相关文件,并准备将这些文件发布出去以便由客户端110来从服务器140获取并呈现在客户端110的浏览器上。随后,文件提供设备150的用户就会调用方法300来对各种网页相关文件进行预处理优化。用户通常会指定要进行预处理的文件目录。
网页相关文件可以是诸如CSS文件之类、会由网页调用来帮助在客户端来呈现网页内容和/或提高与客户端处的用户之间的交互的页面相关文件。这些文件符合HTML标准,并且在HTML中被广泛使用。这些网页相关文件中,还会引用其它网页相关文件。
上面结合图2的描述中已经给出了网页相关文件如CSS的具体示例,这里不再赘述。该方法适于逐个地对用户指定目录下的文件进行处理。例如,该方法会查找该目录下所有文件后缀名为css的文件,并逐个进行处理。
该方法始于步骤S310。在步骤S310中,读取一个网页相关文件的文件内容。例如,在步骤S310中,可以将网页相关文件的文件内容从诸如硬盘之类的大容量存储器读取到缓存中,以便于后续处理。在一个实施例中,甚至可以例如利用HTML引擎对该文件内容进行分析,从而得到该文件中内容的组织结构。例如就CSS而言,可以获得每个CSS的标签(tag)和对应的值(value)。当然,根据本发明的另一个实施例,可以直接将内容读取出 来并进行缓存即可。
随后,在步骤S320中,对在步骤S310中读取的文件内容进行分析,以查找出该文件内容中的各种预定标识以及与这些标识对应的内容。根据本发明的一个实施例,网页相关文件为CSS文件,而预定标识为“@”开头的CSS指令,在步骤S320中,在所读取的文件内容中查找各个CSS指令,并查找各个CSS指令对应的指令内容。根据本发明的又一个实施例,当在步骤S310中获得了文件的组织结构时,则在步骤S320中,可以在该组织结构中进行遍历以查找相应的CSS指令和对应内容。应当注意的是,本发明不受限于步骤S320的具体实现方式,所有可以从所读取的文件内容中查找预定标识以及对应内容的方式都在本发明的保护范围之内。
例如,在上面的示例中,在步骤S320中,可以查找到多个CSS指令,例如@charset、@import以及@media等,并且还查找到对应的指令内容。例如,对应于@charset指令的指令内容为“utf8”,而对应于@import的指令内容为各个应用的CSS文件,对应于@media的内容为打印机的设置等。
在步骤S320中查找到各个预定标识之后,在步骤S330中,根据各个CSS指令,基于与该CSS指令相对应的指令内容来对CSS文件进行处理,从而使得该CSS内容后续可以更高效地由客户端110获取并在客户端解析和处理。步骤S330会根据CSS指令的不同,而采用不同的处理方式。
根据本发明的一个实施例,当要处理的CSS指令为编码处理指令符(即@charset)时,在步骤S330中,确定@charset指令的指令内容,然后根据@charset指令内容定义的编码方式读取文件内容中所有的非英文字符,并且将这些非英文字符转换为unicode(统一码)编码方式编码后的内容。另外可选地,在步骤S330中,可以将@charset指令的指令内容修改为“unicode”。由于浏览器缺省会以unicode的方式来处理CSS文件的内容,因此步骤S330甚至可以删除该指令,从而减少CSS文件的大小。
例如,当CSS内容中的非英文字符是“汉字”时,步骤S330的处理会将其转换为“0x6c49”和“0x5b57”。这样,当客户端110获取该CSS文件并解析其内容时,就不需要再次进行编码转换,而直接读取unicode的内容,从而节省了客户端处理CSS的时间。
根据本发明的还有一个实施例,当在步骤S330中要处理的CSS指令为文件导入处理指令符(即@import)时,确定@import指令的指令内容,然 后根据该指令内容指定的CSS文件位置从文件提供设备150中读取该CSS文件的文件内容,并插入到步骤S310所读取的内容中。由于各个CSS通常会定义不同元素的处理和呈现方式,各个CSS的内容一般不存在前后顺序的问题,因此,在步骤S330中,会读取@import指令所指示的文件内容,并且插入到步骤S310所读取内容的结尾处。随后,在步骤S330中,会删除相应的@import指令。
例如,在上面的示例中,存在一条文件导入指令:
@import url(′top_nav.header.footer.css′);
步骤S330会识别出该文件导入指令指示要导入的文件为top_nav.header.footer.css,随后会读取该文件top_nav.header.footer.css的内容,并且将所读取的内容添加到步骤S310所读取的内容的末尾处。
通过上述处理,可以将CSS文件所引用的更进一步的其他CSS文件合并到一个CSS文件中。当客户端110获取该CSS文件之后,不需要对@import指令进行解析而再去服务器140获取更进一步的其他CSS文件,从而减少了在客户端110和服务器140之间的文件下载请求次数,加快了客户端110解析CSS文件的速度。
根据本发明的还有一个实施例,当步骤S330要处理的CSS指令为其它以@开头的指令符时,由于在对CSS进行解析时,其它以@开头的指令对于网页的呈现并没有作用,为了在客户端110处提高对CSS文件的处理速度,可以在步骤S330中,将这些@指令符以及相应的指令内容删除掉,从而使得客户端在获得CSS文件之后,不用解析这些无关的@指令符,并提高处理效率。
例如,在上面的示例中,存在@media指令及其相关内容:
@media screen{BODY{font-size:12pt;}}
//设置打印机用字体尺寸
@media print{
@import″print.css″
BODY{font-size:8pt;}
}
由于@media指令并不会对在客户端呈现网页内容有所影响,因此,在步骤S330中,删除步骤S310所读取的内容中的该指令以及相关联的指令内容。这样,当客户端110解析经过处理的CSS文件时,该文件中不存在诸如 @media之类的缺省处理指令,从而也不用对这些指令进行额外处理,从而减少了客户端110解析CSS文件的时间。
在步骤S330中完成处理之后,在步骤S340中会读取经过处理的网页相关文件的内容,并输出到外部。例如,可以直接将经过处理的网页相关文件传输到服务器140中,也可以在文件提供设备150的本地存储,并等待所有的网页相关文件处理完成之后,统一由文件提供设备150传输到服务器140并进行存储。
可选地,文件处理方法300还可以包括步骤S350。步骤S350可以在步骤S340输出网页相关文件之前,对经过处理的网页相关文件进行压缩处理。由于现在客户端110处的浏览器都支持接收压缩的文件并进行处理,所以,可以将网页相关文件进行压缩并存储到服务器140中,客户端110可以直接获取经过压缩的文件来处理,这样可以进一步节省在客户端和服务器之间的网络带宽消耗。
另外,在步骤S350中还可以进行一些优化处理,例如可以删除网页相关文件中多余的回车、空格等无效字符,使得网页相关文件的大小更小。当客户端110的数量巨大时,网页相关文件尺寸的少许修改就可以节省大量的网络带宽。
利用根据本发明的文件处理方法300,可以在将诸如CSS文件之类的网页相关文件上传在服务器140以供用户从客户端110下载并解析之前,进行各种预处理优化,例如可以预先对多语言文本进行处理,从而避免了客户端110需要解析非标准的语言内容;可以预先将引用的其它文本合并到网页相关文本中,从而避免了客户端的多次服务器请求;可以预先删除网页相关文本中的无用文本,从而减少了网页相关文本的尺寸,节省了流量等。文件处理设备200通过对诸如CSS文件指令的网页相关文件进行预先优化处理,从而使得客户端110可以更高效地解析并处理各种网页相关文件。
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开 的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的文件处理设备和/或网络系统中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。
例如,图4示出了可以实现根据本发明的文件处理方法的计算设备。该计算设备传统上包括处理器410和以存储器420形式的计算机程序产品或者计算机可读介质。存储器420可以是诸如闪存、EEPROM(电可擦除可编程 只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器420具有用于执行上述方法中的任何方法步骤的程序代码431的存储空间430。例如,用于程序代码的存储空间430可以包括分别用于实现上面的方法中的各种步骤的各个程序代码431。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样的计算机程序产品通常为如参考图5所述的便携式或者固定存储单元。该存储单元可以具有与图4的计算设备中的存储器420类似布置的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括计算机可读代码431’,即可以由例如诸如410之类的处理器读取的代码,这些代码当由计算设备运行时,导致该计算设备执行上面所描述的方法中的各个步骤。
本文中所称的“一个实施例”、“实施例”或者“一个或者多个实施例”意味着,结合实施例描述的特定特征、结构或者特性包括在本发明的至少一个实施例中。此外,请注意,这里“在一个实施例中”的词语例子不一定全指同一个实施例。
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。
此外,还应当注意,本说明书中使用的语言主要是为了可读性和教导的目的而选择的,而不是为了解释或者限定本发明的主题而选择的。因此,在不偏离所附权利要求书的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。对于本发明的范围,对本发明所做的公开是说明性的,而非限制性的,本发明的范围由所附权利要求书限定。

Claims (15)

  1. 一种文件处理设备,包括:
    内容读取器,适于读取要处理文件的文件内容;
    标识查找器,适于在所读取的文件内容中查找预定标识;
    标识处理器,适于根据所述标识查找器查找到的预定标识,对所读取的文件内容进行与所述预定标识对应的操作指令的处理;以及
    输出装置,适于输出经处理的文件内容。
  2. 如权利要求1所述的文件处理设备,其中所述预定标识包括各种处理指示符,以及所述标识处理器包括编码处理器,适于当所述预定标识符为编码处理指示符时,根据与所述编码处理指示符相关联的指示,将所述文件内容中的非英文字符替换为unicode编码后的内容。
  3. 如权利要求1或2所述的文件处理设备,其中所述标识处理器还包括文件导入处理器,适于当所述预定标识为文件导入处理指示符时,读取所述文件导入处理指示符所指示的文件内容,将该内容添加到所述内容读取器读取的文件内容中。
  4. 如权利要求1-3任一个所述的文件处理设备,其中所述标识处理器包括缺省处理器,适于当所述预定标识为缺省处理指示符时,在所读取的文件内容中删除与所述缺省处理指示符相关联的内容。
  5. 如权利要求1-4中任一个所述的文件处理设备,还包括内容压缩装置,适于在所述输出装置输出文件内容之前,对文件内容进行压缩处理。
  6. 如权利要求1-5中任一个所述的文件处理设备,其中所述要处理的文件为级联样式(CSS)文件,所述处理指示符为以“@”开头的CSS指令。
  7. 一种文件处理方法,包括步骤:
    读取要处理文件的文件内容;
    在所读取的文件内容中查找预定标识;
    根据查找到的预定标识,对所读取的文件内容进行与所述预定标识对应的操作指令的处理;以及
    输出经处理的文件内容。
  8. 如权利要求7所述的文件处理方法,其中所述预定标识包括各 种处理指示符,以及所述对所读取的文件内容进行处理的步骤包括:
    当所述预定标识符为编码处理指示符时,根据与所述编码处理指示符相关联的指示,将所述文件内容中的非英文字符替换为unicode编码后的数字串。
  9. 如权利要求7或8所述的文件处理方法,其中所述对所读取的文件内容进行处理的步骤还包括:
    当所述预定标识为文件导入处理指示符时,读取与所述文件导入处理指示符所指示的文件内容,将该内容添加到所述内容读取器读取的文件内容中。
  10. 如权利要求7-9任一个所述的文件处理方法,其中所述对所读取的文件内容进行处理的步骤还包括:
    当所述预定标识为缺省处理指示符时,在所读取的文件内容中删除与所述缺省处理指示符相关联的内容。
  11. 如权利要求7-10中任一个所述的文件处理方法,还包括步骤:
    在输出文件内容之前,对文件内容进行压缩处理。
  12. 如权利要求7-11中任一个所述的文件处理方法,其中所述要处理的文件为级联样式(CSS)文件,所述处理指示符为以“@”开头的CSS指令。
  13. 一种网络系统,包括
    服务器;
    多个客户端,经由网络与服务器进行通信;以及
    文件提供设备,包括如权利要求1-6中任一个所述的文件处理设备,
    其中所述文件提供设备耦接到服务器,将所述文件处理设备处理后的文件传输到服务器并存储其中,以便由多个客户端中的任一个来下载该文件并进行处理。
  14. 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行根据权利要求7-12中的任一个所述的文件处理方法。
  15. 一种计算机可读介质,其中存储了如权利要求14所述的计算机程序。
PCT/CN2015/076112 2014-04-08 2015-04-08 一种文件处理方法、设备和网络系统 WO2015154680A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410138848.0 2014-04-08
CN201410138848.0A CN104978341A (zh) 2014-04-08 2014-04-08 一种文件处理方法、设备和网络系统

Publications (1)

Publication Number Publication Date
WO2015154680A1 true WO2015154680A1 (zh) 2015-10-15

Family

ID=54274856

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/076112 WO2015154680A1 (zh) 2014-04-08 2015-04-08 一种文件处理方法、设备和网络系统

Country Status (2)

Country Link
CN (1) CN104978341A (zh)
WO (1) WO2015154680A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107818108A (zh) * 2016-09-13 2018-03-20 阿里巴巴集团控股有限公司 一种网页渲染方法、装置及系统
CN108153786A (zh) * 2016-12-02 2018-06-12 航天星图科技(北京)有限公司 一种文件处理方法
CN110688118B (zh) * 2019-10-28 2023-05-05 郑州阿帕斯科技有限公司 一种网页优化方法及装置
CN116340268A (zh) * 2023-02-28 2023-06-27 上海安博通信息科技有限公司 一种文件遍历方法、装置以及处理设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090150168A1 (en) * 2007-12-07 2009-06-11 Sap Ag Litigation document management
CN101706761A (zh) * 2009-09-08 2010-05-12 厦门敏讯信息技术股份有限公司 一种无线终端串口参数数据处理的方法及其装置
CN102006174A (zh) * 2010-11-08 2011-04-06 中兴通讯股份有限公司 基于手机用户上网行为的数据处理方法及装置
CN102393849A (zh) * 2011-07-18 2012-03-28 电子科技大学 一种Web日志数据的预处理方法
CN101237658B (zh) * 2007-12-18 2012-06-27 中国移动通信集团设计院有限公司 一种移动通信系统中数据的存储方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127038B (zh) * 2006-08-18 2012-09-19 鸿富锦精密工业(深圳)有限公司 下载网站静态网页的系统及方法
CN102622376A (zh) * 2011-01-28 2012-08-01 北京千橡网景科技发展有限公司 用于合并层叠样式表文件的方法和设备
CN102521266A (zh) * 2011-11-18 2012-06-27 深圳中兴网信科技有限公司 一种实现Javascript文件动态压缩与合并方法
CN103220352B (zh) * 2013-04-15 2017-02-08 福建伊时代信息科技股份有限公司 终端、服务器、文件存储系统和文件存储方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090150168A1 (en) * 2007-12-07 2009-06-11 Sap Ag Litigation document management
CN101237658B (zh) * 2007-12-18 2012-06-27 中国移动通信集团设计院有限公司 一种移动通信系统中数据的存储方法及装置
CN101706761A (zh) * 2009-09-08 2010-05-12 厦门敏讯信息技术股份有限公司 一种无线终端串口参数数据处理的方法及其装置
CN102006174A (zh) * 2010-11-08 2011-04-06 中兴通讯股份有限公司 基于手机用户上网行为的数据处理方法及装置
CN102393849A (zh) * 2011-07-18 2012-03-28 电子科技大学 一种Web日志数据的预处理方法

Also Published As

Publication number Publication date
CN104978341A (zh) 2015-10-14

Similar Documents

Publication Publication Date Title
US20220171915A1 (en) Automated augmentation of text, web and physical environments using multimedia content
US8856647B2 (en) Font handling for viewing documents on the web
WO2015039586A1 (zh) 一种进行网页加载的方法、装置和浏览器
WO2016008347A1 (zh) 版式文档的重排方法、系统及电子阅读终端
WO2015043383A1 (zh) 一种进行网页加载的方法、装置和浏览器
US20120323554A1 (en) Systems and methods for tuning parameters in statistical machine translation
US20160364373A1 (en) Method and apparatus for extracting webpage information
JP6203374B2 (ja) ウェブページ・スタイルアドレスの統合
US10714074B2 (en) Method for reading webpage information by speech, browser client, and server
US20110191328A1 (en) System and method for extracting representative media content from an online document
US20100211605A1 (en) Apparatus and method for unified web-search, selective broadcasting, natural language processing utilities, analysis, synthesis, and other applications for text, images, audios and videos, initiated by one or more interactions from users
CN108021598B (zh) 页面抽取模板匹配方法、装置及服务器
WO2015154680A1 (zh) 一种文件处理方法、设备和网络系统
JP2013546032A (ja) サイトメモリ処理およびクリッピング制御
WO2014108040A1 (zh) 在电子设备上呈现内容的方法和装置
US10152540B2 (en) Linking thumbnail of image to web page
CN102523533A (zh) 视频内容关联的在线视频广告管理方法
WO2015154682A1 (zh) 一种网络请求处理方法、网络服务器和网络系统
KR101931859B1 (ko) 전자문서의 대표 단어 선정 방법, 전자 문서 제공 방법, 및 이를 수행하는 컴퓨팅 시스템
US20110099134A1 (en) Method and System for Agent Based Summarization
US20090313558A1 (en) Semantic Image Collection Visualization
US20130230248A1 (en) Ensuring validity of the bookmark reference in a collaborative bookmarking system
JPH10289250A (ja) Wwwブラウザにおけるurl登録及び表示方式
JP2009259248A (ja) ウェブページに含まれるイメージに対してタグ付けを実行し、その結果を利用してウェブ検索サービスを提供するための方法、装置及びコンピュータ読み取り可能な記録媒体
WO2015154678A1 (zh) 一种文件处理方法、设备和网络系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15777007

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15777007

Country of ref document: EP

Kind code of ref document: A1