WO2012167633A1 - 性能报表的生成方法及装置 - Google Patents

性能报表的生成方法及装置 Download PDF

Info

Publication number
WO2012167633A1
WO2012167633A1 PCT/CN2012/071416 CN2012071416W WO2012167633A1 WO 2012167633 A1 WO2012167633 A1 WO 2012167633A1 CN 2012071416 W CN2012071416 W CN 2012071416W WO 2012167633 A1 WO2012167633 A1 WO 2012167633A1
Authority
WO
WIPO (PCT)
Prior art keywords
performance report
xml file
batches
report
generating
Prior art date
Application number
PCT/CN2012/071416
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 WO2012167633A1 publication Critical patent/WO2012167633A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/02Standardisation; Integration
    • H04L41/0246Exchanging or transporting network management information using the Internet; Embedding network management web servers in network elements; Web-services-based protocols
    • H04L41/0266Exchanging or transporting network management information using the Internet; Embedding network management web servers in network elements; Web-services-based protocols using meta-data, objects or commands for formatting management information, e.g. using eXtensible markup language [XML]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/02Standardisation; Integration
    • H04L41/024Standardisation; Integration using relational databases for representation of network management data, e.g. managing via structured query language [SQL]

Definitions

  • the present invention relates to the field of communications, and in particular to a method and apparatus for generating a performance report.
  • the performance report includes important Key Performance Indicator (KPI) information, abnormal alarm information, and configuration parameter information, which can help maintenance personnel perform positioning analysis, develop maintenance plans, and prevent network failures.
  • KPI Key Performance Indicator
  • the performance report Through the performance report, the workload of the maintenance personnel is reduced, the work efficiency and the accuracy of the fault location are improved, and the operator can grasp the dynamic changes of the network at any time.
  • the network management system provides a large number of performance reports, and the information of these reports is very rich. As the capacity of the network management system increases, the period of data query becomes longer, and the number of indicators increases. This causes the data volume of the performance report to increase significantly, reaching the scale of hundreds of thousands of records.
  • the present invention provides a method and an apparatus for generating a performance report, so as to at least solve the problem that a large amount of memory or even a memory overflow occurs when a report is generated by using a large amount of data in the related art.
  • a method of generating a performance report is provided.
  • the method for generating a performance report includes: obtaining a data element for generating a performance report; writing the data element to an Extensible Markup Language (XML) file in batches; and performing the XML file in batches Parse and get the performance report.
  • Obtaining the data elements used to generate the performance report includes: Obtaining the raw data used to generate the performance report; Constructing the data elements based on the raw data.
  • Obtaining the raw data used to generate the performance report includes: parsing the task used to generate the performance report, obtaining the indicators and constraints; constructing the query parameters using the indicators and constraints; querying the database using the query parameters to obtain the original data.
  • writing the data elements to the XML file in batches includes: writing the data elements corresponding to the plurality of tasks to the XML file according to the order of the multiple tasks .
  • the XML file is parsed in batches, and the performance report is obtained.
  • the SAX technology is used to parse the XML file in batches to obtain the performance report in Excel format.
  • the XML file is parsed in batches, and the performance report in Excel format includes at least one of the following: In the case of parsing to the start mark report, continuing to parse the XML file line by line; In this case, the XML file is continuously parsed line by line; in the case of parsing to the end of the XML file, a performance report in Excel format is generated.
  • the XML file is parsed in batches, and the performance report is obtained.
  • the STX technology is used to convert the XML file and the image in batches according to a preset format, and the Hypertext Markup Language (HTML) format is obtained. Performance report, where the image is generated from data elements.
  • HTML Hypertext Markup Language
  • the preset format is determined by the format control file, wherein the format control file includes one of the following; the overall frame of the HTML, the font of the text, and the color of the text.
  • a device for generating a performance report comprises: an obtaining module configured to acquire a data element for generating a performance report; a writing module configured to write the data element to the XML file in batches; and a parsing module, set to batch Parse the XML file to get the performance report.
  • the acquisition module includes: an acquisition submodule, configured to obtain raw data for generating a performance report; a construction submodule, configured to construct a data element based on the original data.
  • the invention writes the data elements into the XML file in batches, and parses the XML files in batches, so that the entire XML file does not need to be read into the memory, thereby greatly reducing the memory requirement, thereby ensuring the generation of the performance report.
  • FIG. 1 is a structural block diagram of a generation system of a performance report according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a method for generating a performance report according to an embodiment of the present invention
  • FIG. 3 is a diagram of generating an XML file according to a preferred embodiment of the present invention.
  • FIG. 4 is a flow chart for generating an EXCEL format performance report in accordance with a preferred embodiment of the present invention
  • FIG. 5 is a flow chart for generating an HTML format performance report in accordance with a preferred embodiment of the present invention
  • FIG. 6 is a flowchart in accordance with an embodiment of the present invention.
  • a block diagram of the device for generating performance reports. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict. The invention will be described in detail below with reference to the drawings in conjunction with the embodiments. 1 is a structural block diagram of a performance report generation system according to an embodiment of the present invention. As shown in FIG.
  • the report template module 12 parses various tasks of the report and indicators and constraints of each task according to the configuration file; the report generating module 14 is connected to the report template module 12, and analyzes the indicators to be queried one by one according to each report task.
  • the query performance indicator generates raw data, the original data generates an XML file, and finally parses and converts it into an EXCEL and HTML format report; the interface display module 16 is connected to the report generation module 14, and the generated HTML report is performed in different manners on the interface. Display; generated EXCEL report, which can be exported and viewed locally.
  • Step S202 obtaining a data element for generating a performance report.
  • Step S204 the data elements are written to the XML file in batches.
  • Step S206 parsing the XML file in batches to obtain a performance report.
  • obtaining the data elements used to generate the performance report comprises: obtaining raw data used to generate the performance report; constructing the data element according to the original data.
  • obtaining the original data used to generate the performance report includes: parsing a task for generating a performance report, obtaining indicators and constraints; constructing query parameters by using the indicator and the constraint; and querying the database by using the query parameter to obtain the original data.
  • writing the data elements to the XML file in batches includes: writing the data elements corresponding to the plurality of tasks in the order of the multiple tasks Go to the XML file. The preferred embodiment contemplates the presence of multiple tasks.
  • the performance reports corresponding to the multiple tasks can be generated, and a large amount of memory is not consumed because the data volume of the multiple tasks is too large.
  • the XML file is parsed in batches, and the performance report is obtained as follows:
  • the SAX Simple API for XML
  • the SAX in the preferred embodiment has the principle of sequentially scanning the document, and notifying the event processing function when scanning the start and end of the document, the start and end of the element, the end of the document, and the like.
  • the corresponding action is performed by the event handler, and then the same scan is continued until the end of the document.
  • the SA technology is used to parse the XML file in batches
  • the performance report in the Excel format includes at least one of the following: In the case of parsing to the start flag report, continuing to parse the XML file line by line; In the case of the mark section, the XML file is continuously parsed line by line; in the case of parsing to the end of the XML file, a performance report in Excel format is generated.
  • the parsing process in the preferred embodiment will be described below with reference to examples.
  • the XML file is: ⁇ doc>
  • the document is parsed.
  • the XML file is parsed in batches, and the performance report is obtained by: using STX (Streaming Transformations for XML) technology, converting XML files and images in batches according to a preset format, and obtaining performance reports in HTML format.
  • the image is generated from the data elements.
  • STX Streaming Transformations for XML
  • the STX in the preferred embodiment is a language stream conversion technology for XML, which does not need to load the entire XML file into the memory, and sequentially reads and parses the data of each row, and can execute the XML.
  • Files are converted to EXCEL files in a specific format, greatly reducing memory usage.
  • the preset format is determined by a format control file, wherein the format control file includes one of the following; an overall frame of the HTML, a font of the text, and a color of the text.
  • the method further includes displaying the performance report in the browser through the interface display module 16 or exporting the performance report through the EXCEL.
  • the process of generating an XML file, the process of generating an EXCEL format performance report, and the process of generating an HTML format performance report are described in detail in the following embodiments in conjunction with FIG. 3 to FIG.
  • FIG. 3 is a flow chart of generating an XML file according to a preferred embodiment of the present invention. As shown in FIG. 3, the following steps S302 to S316 are included.
  • Step S302 Acquire and parse each report task to be processed.
  • step S304 it is checked whether the report task is all executed. If yes, go to step S314, otherwise proceed to step S306.
  • Step S306 processing each report task, parsing the indicator set, the indicator and the constraint condition of each report task.
  • step S308 it is determined whether the indicator is legal, that is, whether the network element type of the indicator is correct, whether the indicator set includes the indicator, and if yes, proceeding to step S310; otherwise, proceeding to step S306.
  • Step S310 constructing a query parameter query.
  • Step S312 obtaining a query result, and generating a picture of the change trend of the indicator time point or the time period according to the result, constructing a link of the XML node and each report task.
  • the report task is executed, and the SA conversion factory is created.
  • step S316 the SA parsing event is used, and the data of each report task is sequentially written to generate XML containing the indicator data.
  • 4 is a flow chart of generating an EXCEL format performance report according to a preferred embodiment of the present invention. As shown in FIG. 4, the following steps S402 to S416 are included.
  • an SA parser is created to prepare for parsing the XML.
  • Step S404 the parser parses the XML, reads each row of data from beginning to end, and generates corresponding events.
  • step S406 it is judged whether the end of the file is reached, if yes, the process goes to step S416, and if not, the process proceeds to step S408.
  • step S408 it is determined whether a start tag (report, ie report) is encountered. If it is encountered, it is the root node of the report, and the process proceeds to step S410, otherwise, the process goes to step S404.
  • Step S410 processing data and child nodes of the node element.
  • step S412 it is judged whether a start mark (part, ie, section) is encountered.
  • Step S414 processing the data, reading the data of each sheet page of the report and writing.
  • FIG. 5 is a flowchart of generating an HTML format performance report according to a preferred embodiment of the present invention. As shown in FIG. 5, the following steps S502 to S508 are included. Step S502, reading an XML file storing the indicator data and the image link. Step S504, reading the HTML format control xls file, the file defines the overall frame of the HTML, the font of the text, the color and the like.
  • Step S506 copying the picture file and the XML file and the format control file to the specified directory.
  • Step S508 the data information plus the format control file is converted into an HTML format report.
  • the embodiment of the invention provides a device for generating a performance report, and the device for generating the performance report can be used to implement the method for generating the performance report.
  • FIG. 6 is a structural block diagram of a device for generating a performance report according to an embodiment of the present invention. As shown in FIG.
  • the method includes an obtaining module 62, a writing module 64, and a parsing module 66.
  • the structure is described in detail below.
  • the obtaining module 62 is configured to obtain a data element for generating a performance report;
  • the writing module 64 is connected to the obtaining module 62, and configured to write the data elements acquired by the obtaining module 62 to the XML file in batches;
  • the write module 64 is configured to parse the XML file in which the write module 64 writes the data element in batches to obtain a performance report.
  • a large amount of data is used to generate a report, it consumes a large amount of memory or even overflows the memory.
  • the inventors found that simply increasing the memory resources does not solve the problem. Furthermore, the inventors have found that all the XML files loaded into the memory for parsing in the related art are the root cause of the problem. Therefore, in the embodiment of the present invention, the data element is written into the XML file in batches by the writing module 64, and the XML file is parsed in batches by the parsing module 66, thereby eliminating the need to read the entire XML file into the memory, thereby greatly reducing The memory requirements, in turn, can guarantee the generation of performance reports.
  • the acquisition module 62 includes an acquisition sub-module 622 and a construction sub-module 624. The structure is described in detail below.
  • the acquisition sub-module 622 is configured to obtain the original data for generating the performance report; the construction sub-module 624 is coupled to the acquisition sub-module 622, and configured to construct the data element according to the original data acquired by the acquisition sub-module 622.
  • the device for generating the performance report described in the device embodiment corresponds to the foregoing method embodiment, and the specific implementation process has been described in detail in the method embodiment, and details are not described herein again.
  • a method and apparatus for generating a performance report are provided.
  • the invention writes the data elements into the XML file in batches, and parses the XML files in batches, so that the entire XML file does not need to be read into the memory, thereby greatly reducing the memory requirement, thereby ensuring the generation of the performance report.
  • modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices.
  • they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device, or they may be separately fabricated into individual integrated circuit modules, or they may be Multiple modules or steps are made into a single integrated circuit module.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Document Processing Apparatus (AREA)

Abstract

本条公开条种性能报表的生成方法及装置,该方法包括:获取用于生成性能报表的数据元素;分批将数据元素写入到可扩展标记语言XML文件;分批对XML文件进行解析,得到性能报表。本条通过分批将数据元素写入到XML文件,并分批对该XML文件进行解析,从而无须将整个XML文件读入内存,大大降低了对内存的要求,进而可以保证性能报表的生成。

Description

性能报表的生成方法及装置 技术领域 本发明涉及通信领域, 具体而言, 涉及一种性能报表的生成方法及装置。 背景技术 性能报表包括了重要的关键绩效指标 (Key Performance Indicator, 简称为 KPI) 信息、 异常告警信息以及配置参数信息, 能辅助维护人员进行定位分析、 制定维护方 案、 预防网络故障。 通过性能报表, 减轻了维护人员的工作负担, 提高工作效率和故 障定位的准确性, 令运营商能随时掌握网络的动态变化情况。 目前, 网管系统提供大量的性能报表, 这些报表的信息非常丰富。 随着网管系统 的容量增大, 数据查询的周期变长, 指标个数增多, 这就造成性能报表的数据量显著 增大, 达到几十万条记录的规模。 因此, 当上述这些数据生成报表时, 需要消耗大量内存甚至使内存溢出, 导致性 能报表无法生成, 造成网管系统崩溃。 发明内容 本发明提供了一种性能报表的生成方法及装置, 以至少解决相关技术中使用大量 数据生成报表时需要消耗大量内存甚至使内存溢出的问题。 为了实现上述目的, 根据本发明的一个方面, 提供了一种性能报表的生成方法。 根据本发明的性能报表的生成方法包括: 获取用于生成性能报表的数据元素; 分 批将数据元素写入到可扩展标记语言(Extensible Markup Language, 简称为 XML)文 件; 分批对 XML文件进行解析, 得到性能报表。 获取用于生成性能报表的数据元素包括: 获取用于生成性能报表的原始数据; 根 据原始数据, 构造数据元素。 获取用于生成性能报表的原始数据包括: 解析用于生成性能报表的任务, 得到指 标及约束条件; 使用指标及约束条件, 构造查询参数; 使用查询参数查询数据库, 得 到原始数据。 在存在多个用于生成性能报表的任务的情况下, 分批将数据元素写入到 XML文 件包括: 按照该多个任务的顺序, 分别将该多个任务对应的数据元素写入到 XML文 件。 分批对 XML文件进行解析, 得到性能报表包括: 采用 SAX技术, 分批对 XML 文件进行解析, 得到 Excel格式的性能报表。 采用 SA 技术, 分批对 XML文件进行解析, 得到 Excel格式的性能报表包括以 下至少之一: 在解析到开始标记 report的情况下, 继续对 XML文件进行逐行解析; 在解析到开始标记 section的情况下,继续对 XML文件进行逐行解析;在解析到 XML 文件的结尾的情况下, 生成 Excel格式的性能报表。 分批对 XML文件进行解析, 得到性能报表包括: 采用 STX技术, 按照预先设定 的格式, 分批对 XML文件和图片进行转换, 得到超文本标记语言 (Hypertext Markup Language, 简称为 HTML) 格式的性能报表, 其中图片是根据数据元素生成的。 通过格式控制文件确定预先设定的格式,其中格式控制文件包括以下之一; HTML 的整体框架、 文字的字体、 文字的颜色。 为了实现上述目的,根据本发明的另一个方面,提供了一种性能报表的生成装置。 根据本发明的性能报表的生成装置包括: 获取模块, 设置为获取用于生成性能报 表的数据元素; 写入模块, 设置为分批将数据元素写入到 XML文件; 解析模块, 设 置为分批对 XML文件进行解析, 得到性能报表。 获取模块包括: 获取子模块, 设置为获取用于生成性能报表的原始数据; 构造子 模块, 设置为根据原始数据, 构造数据元素。 本发明通过分批将数据元素写入到 XML文件, 并分批对该 XML文件进行解析, 从而无须将整个 XML文件读入内存, 大大降低了对内存的要求, 进而可以保证性能 报表的生成。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部分, 本发 明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在附图 中: 图 1是根据本发明实施例的性能报表的生成系统的结构框图; 图 2是根据本发明实施例的性能报表的生成方法的流程图; 图 3是根据本发明优选实施例的生成 XML文件的流程图; 图 4是根据本发明优选实施例的生成 EXCEL格式性能报表的流程图; 图 5是根据本发明优选实施例的生成 HTML格式性能报表的流程图; 图 6是根据本发明实施例的性能报表的生成装置的结构框图。 具体实施方式 需要说明的是, 在不冲突的情况下, 本申请中的实施例及实施例中的特征可以相 互组合。 下面将参考附图并结合实施例来详细说明本发明。 图 1是根据本发明实施例的性能报表的生成系统的结构框图, 如图 1所示, 包括 报表模板模块 12,报表生成模块 14和界面展示模块 16。下面对其结构进行详细描述。 报表模板模块 12, 根据配置文件解析出报表的各种任务及每种任务的指标和限制 条件; 报表生成模块 14, 连接至报表模板模块 12, 根据每个报表任务, 逐一分析要查 询的指标, 查询性能指标生成原始数据, 原始数据生成 XML文件, 最后将其解析转 换为 EXCEL和 HTML格式的报表; 界面展示模块 16, 连接至报表生成模块 14, 生成 的 HTML报表, 在界面上以不同方式进行展示; 生成的 EXCEL报表, 可导出在本地 查看。 图 2是根据本发明实施例的性能报表的生成方法的流程图, 该性能报表的生成方 法主要通过上述报表生成模块 14的操作而实现, 如图 2所示, 包括如下的步骤 S202 至步骤 S206。 步骤 S202, 获取用于生成性能报表的数据元素。 步骤 S204, 分批将数据元素写入到 XML文件。 步骤 S206, 分批对 XML文件进行解析, 得到性能报表。 相关技术中, 当使用大量数据生成报表时, 需要消耗大量内存甚至使内存溢出。 同时, 发明人发现一味的增加内存资源并不能解决该问题, 进而, 发明人发现相关技 术中的将 XML文件全部加载到内存中进行解析才是该问题出现的根源。 因此, 本发 明实施例中,通过分批将数据元素写入到 XML文件,并分批对该 XML文件进行解析, 从而无须将整个 XML文件读入内存, 大大降低了对内存的要求, 进而可以保证性能 报表的生成。 优选地, 获取用于生成性能报表的数据元素包括: 获取用于生成性能报表的原始 数据; 根据原始数据, 构造数据元素。 优选地, 获取用于生成性能报表的原始数据包括: 解析用于生成性能报表的任务, 得到指标及约束条件; 使用指标及约束条件, 构造查询参数; 使用查询参数查询数据 库, 得到原始数据。 优选地, 在存在多个用于生成性能报表的任务的情况下, 分批将数据元素写入到 XML 文件包括: 按照该多个任务的顺序, 分别将该多个任务对应的数据元素写入到 XML文件。 本优选实施例考虑到了存在多个任务的情况。 通过区分该多个任务, 并按照其顺 序分别写入到 XML文件, 可以生成该多个任务对应的性能报表, 并且不会因为该多 个任务的数据量过大而消耗大量内存。 优选地, 分批对 XML文件进行解析, 得到性能报表包括: 采用 SAX ( Simple API for XML) 技术, 分批对 XML文件进行解析, 得到 Excel格式的性能报表。 需要说明的是, 本优选实施例中的 SAX, 其原理是对文档进行顺序扫描, 当扫描 到文档 (document) 开始与结束、 元素 (element) 开始与结束、 文档结束等地方时通 知事件处理函数, 由事件处理函数做相应动作, 然后继续同样的扫描, 直至文档结束。 这样不用将整个 XML加载到内存, 特别是对大型 (数据量大) 文件能够提供更快更 有效的解析方法。 优选地, 采用 SA 技术, 分批对 XML文件进行解析, 得到 Excel格式的性能报 表包括以下至少之一: 在解析到开始标记 report的情况下, 继续对 XML文件进行逐 行解析; 在解析到开始标记 section的情况下, 继续对 XML文件进行逐行解析; 在解 析到 XML文件的结尾的情况下, 生成 Excel格式的性能报表。 下面结合实例对本优选实施例中的解析过程进行描述。 假设 XML文件为: <doc>
<para>Hello,World!</para> </doc> 则其解析的过程为: 1.读到文档开始标识符 , 角虫发事件 start document ;
2.读到元素开始标识符 , 触发事件 start element , 解析出元素 doc;
3.读到元素开始标识符 , 触发事件 start element, 解析出元素 para;
4.读到文字开始标识符 , 解析出文字 Hello, World!
5.读到元素结束标识符 , 触发事件 end element; 6.读到元素结束标识符 , 触发事件 end element;
7.读到元素结束标识符 , 角虫发事件 end document ;
8.文档解析完毕。 优选地, 分批对 XML文件进行解析, 得到性能报表包括: 采用 STX ( Streaming Transformations for XML) 技术, 按照预先设定的格式, 分批对 XML文件和图片进行 转换, 得到 HTML格式的性能报表, 其中图片是根据数据元素生成的。 需要说明的是, 本优选实施例中的 STX, 其是一种用于 XML的语言流转换技术, 不需要将整个 XML文件加载到内存中, 顺序读取解析每行的数据, 就可以将 XML文 件按特定格式转换为 EXCEL文件, 大大降低了内存的占用。 优选地, 通过格式控制文件确定预先设定的格式, 其中格式控制文件包括以下之 一; HTML的整体框架、 文字的字体、 文字的颜色。 优选地,在得到性能报表之后, 上述方法还包括通过界面展示模块 16在浏览器中 显示该性能报表或者通过 EXCEL导出该性能报表。 下面结合图 3至图 5,分别对本发明实施例的生成 XML文件的流程、生成 EXCEL 格式性能报表的流程以及生成 HTML格式性能报表的流程进行详细描述。 图 3是根据本发明优选实施例的生成 XML文件的流程图, 如图 3所示, 包括如 下的步骤 S302至步骤 S316。 步骤 S302, 获取并解析待处理的每个报表任务。 步骤 S304, 检查报表任务是否都执行完毕, 如果是则转步骤 S314, 否则继续进 行步骤 S306。 步骤 S306, 处理每一个报表任务, 解析出每个报表任务的指标集合、 指标及约束 条件。 步骤 S308, 解析指标是否合法, 即指标的网元类型是否正确, 指标集合是否包含 此指标, 如果是则继续进行步骤 S310, 否则转步骤 S306。 步骤 S310, 构造查询参数查询。 步骤 S312,获取查询结果,根据结果生成指标时间点或时间段内变化趋势的图片, 构造 XML的节点和每个报表任务的链接。 步骤 S314, 报表任务执行完毕, 创建 SA 转换工厂。 步骤 S316, 采用 SA 解析事件, 顺序写入每个报表任务的数据, 生成包含指标 数据的 XML。 图 4是根据本发明优选实施例的生成 EXCEL格式性能报表的流程图, 如图 4所 示, 包括如下的步骤 S402至步骤 S416。 步骤 S402, 创建 SA 解析器, 为解析 XML做准备。 步骤 S404, 解析器对 XML进行解析, 从头至尾读取每行数据, 产生相应的一些 事件。 步骤 S406, 判断是否到了文件末尾, 如果是则转步骤 S416, 如果不是则继续进 行步骤 S408。 步骤 S408, 判断是否遇到开始标记(报告, 即 report), 如果遇到则是报表的根节 点, 继续进行步骤 S410, 否则转步骤 S404。 步骤 S410, 处理这个节点元素的数据及子节点。 步骤 S412, 判断是否遇到开始标记 (部分, 即 section), 如果遇到则是报表的每 个页面, 即 sheet页, 继续进行步骤 S414, 否则转步骤 S408。 步骤 S414, 处理数据, 读取报表每个 sheet页的数据并写入。 步骤 S416, 解析完 XML文件, 生成 EXCEL格式报表。 图 5是根据本发明优选实施例的生成 HTML格式性能报表的流程图,如图 5所示, 包括如下的步骤 S502至步骤 S508。 步骤 S502, 读取存有指标数据和图片链接的 XML文件。 步骤 S504, 读取 HTML格式控制 xls文件, 这个文件里定义了 HTML的整体框 架、 文字的字体、 颜色等信息。 步骤 S506, 拷贝图片文件和 XML文件、 格式控制文件到指定目录。 步骤 S508, 数据信息加上格式控制文件转换为 HTML格式报表。 需要说明的是, 在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的 计算机系统中执行, 并且, 虽然在流程图中示出了逻辑顺序, 但是在某些情况下, 可 以以不同于此处的顺序执行所示出或描述的步骤。 本发明实施例提供了一种性能报表的生成装置, 该性能报表的生成装置可以用于 实现上述性能报表的生成方法。 图 6是根据本发明实施例的性能报表的生成装置的结 构框图, 如图 6所示, 包括获取模块 62、 写入模块 64和解析模块 66。 下面对其结构 进行详细描述。 获取模块 62, 设置为获取用于生成性能报表的数据元素; 写入模块 64, 连接至获 取模块 62, 设置为分批将获取模块 62获取的数据元素写入到 XML文件; 解析模块 66,连接至写入模块 64, 设置为分批对写入模块 64写入数据元素的 XML文件进行解 析, 得到性能报表。 相关技术中, 当使用大量数据生成报表时, 需要消耗大量内存甚至使内存溢出。 同时, 发明人发现一味的增加内存资源并不能解决该问题, 进而, 发明人发现相关技 术中的将 XML文件全部加载到内存中进行解析才是该问题出现的根源。 因此, 本发 明实施例中,通过写入模块 64分批将数据元素写入到 XML文件, 并通过解析模块 66 分批对该 XML文件进行解析, 从而无须将整个 XML文件读入内存, 大大降低了对内 存的要求, 进而可以保证性能报表的生成。 优选地, 获取模块 62包括获取子模块 622和构造子模块 624。 下面对其结构进行 详细描述。 获取子模块 622, 设置为获取用于生成性能报表的原始数据; 构造子模块 624, 连 接至获取子模块 622, 设置为根据获取子模块 622获取的原始数据, 构造数据元素。 需要说明的是, 装置实施例中描述的性能报表的生成装置对应于上述的方法实施 例, 其具体的实现过程在方法实施例中已经进行过详细说明, 在此不再赘述。 综上所述, 根据本发明的上述实施例, 提供了一种性能报表的生成方法及装置。 本发明通过分批将数据元素写入到 XML文件, 并分批对该 XML文件进行解析, 从而 无须将整个 XML文件读入内存, 大大降低了对内存的要求, 进而可以保证性能报表 的生成。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可以用通用 的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布在多个计算装置所 组成的网络上, 可选地, 它们可以用计算装置可执行的程序代码来实现, 从而, 可以 将它们存储在存储装置中由计算装置来执行, 或者将它们分别制作成各个集成电路模 块, 或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。 这样, 本发明 不限制于任何特定的硬件和软件结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技 术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的 任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。

Claims

权 利 要 求 书
1. 一种性能报表的生成方法, 包括:
获取用于生成性能报表的数据元素;
分批将所述数据元素写入到可扩展标记语言 XML文件;
分批对所述 XML文件进行解析, 得到所述性能报表。
2. 根据权利要求 1所述的方法, 其中, 获取用于生成性能报表的数据元素包括: 获取用于生成性能报表的原始数据;
根据所述原始数据, 构造所述数据元素。
3. 根据权利要求 2所述的方法, 其中, 获取用于生成性能报表的原始数据包括: 解析用于生成性能报表的任务, 得到指标及约束条件;
使用所述指标及所述约束条件, 构造查询参数;
使用所述查询参数查询数据库, 得到所述原始数据。
4. 根据权利要求 3所述的方法, 其中, 在存在多个所述用于生成性能报表的任务 的情况下, 分批将所述数据元素写入到 XML文件包括: 按照该多个任务的顺 序, 分别将该多个任务对应的数据元素写入到所述 XML文件。
5. 根据权利要求 1至 4中任一项所述的方法, 其中, 分批对所述 XML文件进行 解析, 得到所述性能报表包括: 采用 SAX技术, 分批对所述 XML文件进行解 析, 得到 Excel格式的性能报表。
6. 根据权利要求 5所述的方法, 其中, 采用 SAX技术, 分批对所述 XML文件进 行解析, 得到 Excel格式的性能报表包括以下至少之一:
在解析到开始标记 report的情况下, 继续对所述 XML文件进行逐行解析; 在解析到开始标记 section的情况下,继续对所述 XML文件进行逐行解析; 在解析到所述 XML文件的结尾的情况下,生成所述 Excel格式的性能报表。
7. 根据权利要求 1至 4中任一项所述的方法, 其中, 分批对所述 XML文件进行 解析, 得到所述性能报表包括: 采用 STX技术, 按照预先设定的格式, 分批对 所述 XML文件和图片进行转换, 得到 HTML格式的性能报表, 其中所述图片 是根据所述数据元素生成的。 根据权利要求 7所述的方法, 其中, 通过格式控制文件确定所述预先设定的格 式, 其中所述格式控制文件包括以下之一: HTML的整体框架、 文字的字体、 文字的颜色。 一种性能报表的生成装置, 包括:
获取模块, 设置为获取用于生成性能报表的数据元素;
写入模块, 设置为分批将所述数据元素写入到可扩展标记语言 XML文件; 解析模块, 设置为分批对所述 XML文件进行解析, 得到所述性能报表。 根据权利要求 9所述的装置, 其中, 所述获取模块包括: 获取子模块, 设置为获取用于生成性能报表的原始数据;
构造子模块, 设置为根据所述原始数据, 构造所述数据元素。
PCT/CN2012/071416 2011-06-08 2012-02-21 性能报表的生成方法及装置 WO2012167633A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110152520.0A CN102215126B (zh) 2011-06-08 2011-06-08 性能报表的生成方法及装置
CN201110152520.0 2011-06-08

Publications (1)

Publication Number Publication Date
WO2012167633A1 true WO2012167633A1 (zh) 2012-12-13

Family

ID=44746265

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/071416 WO2012167633A1 (zh) 2011-06-08 2012-02-21 性能报表的生成方法及装置

Country Status (2)

Country Link
CN (1) CN102215126B (zh)
WO (1) WO2012167633A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111796805A (zh) * 2019-06-27 2020-10-20 上海市计量测试技术研究院 一种aml语言性能验证方法

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102215126B (zh) * 2011-06-08 2017-11-03 中兴通讯股份有限公司 性能报表的生成方法及装置
CN103885999B (zh) * 2013-03-28 2017-11-07 中国证券监督管理委员会信息中心 一种定义xbrl和业务对应关系的标引模板
CN104346407B (zh) * 2013-08-08 2017-12-08 航天信息股份有限公司 数据申报系统中报表和xml文件数据交互的方法及其装置
CN103500196B (zh) * 2013-09-22 2016-09-14 成都交大光芒科技股份有限公司 多并发大数据量环境下excel数据导出方法及其导出装置
CN104636127A (zh) * 2014-08-06 2015-05-20 歌尔声学股份有限公司 开发报表或看板的方法及装置
CN104462166A (zh) * 2014-08-28 2015-03-25 大唐移动通信设备有限公司 一种报表生成方法和系统
CN105260444A (zh) * 2015-10-09 2016-01-20 深圳市华讯方舟科技有限公司 数据自适应显示方法、终端设备及服务器
CN107145534A (zh) * 2017-04-18 2017-09-08 北京思特奇信息技术股份有限公司 一种基于云运维操作管理平台的页面展示方法
CN109783554A (zh) * 2018-12-13 2019-05-21 重庆金融资产交易所有限责任公司 excel文档解析方法、装置及计算机可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101122899A (zh) * 2007-09-18 2008-02-13 杭州华三通信技术有限公司 报表的生成方法和设备
CN101329665A (zh) * 2007-06-18 2008-12-24 国际商业机器公司 解析标记语言文档的方法和解析器
CN101826085A (zh) * 2009-12-30 2010-09-08 厦门市美亚柏科信息股份有限公司 一种基于ajax的网页在线导入/导出大文件的方法
CN102215126A (zh) * 2011-06-08 2011-10-12 中兴通讯股份有限公司 性能报表的生成方法及装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101650711A (zh) * 2009-08-18 2010-02-17 深圳市科陆电子科技股份有限公司 一种报表的生成方法
CN101794289A (zh) * 2009-12-30 2010-08-04 北京数码大方科技有限公司 导出数据的方法与系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101329665A (zh) * 2007-06-18 2008-12-24 国际商业机器公司 解析标记语言文档的方法和解析器
CN101122899A (zh) * 2007-09-18 2008-02-13 杭州华三通信技术有限公司 报表的生成方法和设备
CN101826085A (zh) * 2009-12-30 2010-09-08 厦门市美亚柏科信息股份有限公司 一种基于ajax的网页在线导入/导出大文件的方法
CN102215126A (zh) * 2011-06-08 2011-10-12 中兴通讯股份有限公司 性能报表的生成方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
OLIVER BECKER ET AL.: "An Introduction to Streaming Transformations for XML.", XML.COM, 26 February 2003 (2003-02-26), pages 1 - 7, Retrieved from the Internet <URL:www.xml.com.> *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111796805A (zh) * 2019-06-27 2020-10-20 上海市计量测试技术研究院 一种aml语言性能验证方法
CN111796805B (zh) * 2019-06-27 2024-05-07 上海市计量测试技术研究院 一种aml语言性能验证方法

Also Published As

Publication number Publication date
CN102215126A (zh) 2011-10-12
CN102215126B (zh) 2017-11-03

Similar Documents

Publication Publication Date Title
WO2012167633A1 (zh) 性能报表的生成方法及装置
CN111083225B (zh) 在物联网平台中的数据处理方法、装置及物联网平台
CN109558290B (zh) 服务器、接口自动化测试方法及存储介质
CN108009264B (zh) 一种用于Excel格式文档的数据版本的比较方法
CN111585344B (zh) 一种基于全站ied仿真的变电站智能校核方法及装置
WO2011029252A1 (zh) 一种基于数据定义的web页面快速生成方法及装置
CN103268226A (zh) 一种测试脚本文件生成方法及装置
CN102043837A (zh) 数据整合系统和方法
US20070240034A1 (en) Streaming XML patch
US20070130514A1 (en) Dynamic data presentation
CN102043836A (zh) 数据适配装置和方法
US8255356B2 (en) Apparatus and method of generating document
CN113065779B (zh) 数据处理方法、装置和电子设备
CN113360139A (zh) 前端框架的集成方法、装置、电子设备及存储介质
CN105279032B (zh) 一种同步接口报文与javaBean的方法及装置
CN103793464A (zh) 一种基于中立格式的报表导出方法
CN115495082B (zh) Tlv格式数据自动转换方法及相关设备
WO2014180401A1 (zh) 业务模型的适配方法及系统
US20040153871A1 (en) Automatic analysis of the properties of a system based on runtime logs
CN116069649A (zh) 页面测试方法、装置、设备及介质
CN116932358A (zh) 一种测试数据构造方法、装置及计算机设备
CN102622351B (zh) 转换网络页面类型的方法、装置和系统
US20140025696A1 (en) Method, Program and System for Generating RDF Expressions
CN112307384A (zh) 页面快照展示方法、装置、电子设备及存储介质
CN101882072A (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: 12796900

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: 12796900

Country of ref document: EP

Kind code of ref document: A1