作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程

• 先进计算与数据处理 • 上一篇    下一篇

基于文档对象模型的改进SCL 文件解析算法

王友钊1,温 琪1,黄 静2   

  1. (1. 浙江大学数字技术及仪器研究所,杭州310027;2. 浙江理工大学信息电子学院,杭州310018)
  • 收稿日期:2013-10-09 出版日期:2014-09-15 发布日期:2014-09-12
  • 作者简介:王友钊(1963 - ),男,副教授,主研方向:数据处理,智能电网;温 琪,硕士研究生;黄 静,教授。
  • 基金资助:
    国家自然科学基金资助项目(51375459)。

Improved SCL File Parsing Algorithm Based on Document Object Model

WANG You-zhao 1,WEN Qi 1,HUANG Jing 2   

  1. (1. Institute of Advanced Digital Technology and Instrument,Zhejiang University,Hangzhou 310027,China; 2. College of Informatics & Electronics,Zhejiang Sci-tech University,Hangzhou 310018,China)
  • Received:2013-10-09 Online:2014-09-15 Published:2014-09-12

摘要: 基于文档对象模型(DOM)的变电站配置描述语言(SCL)文件解析算法在解析文件时会将整个SCL 文档 内容在内存中展开,并将文件内容转化为树状节点的结构,占用较大的内容空间。针对该问题,对传统DOM 算法 进行改进,利用SCL 文件的文本节点信息存在冗余的特性,分别使用动态数组、散列表以及二叉平衡查找树3 种数 据结构为文本节点建立索引并去除冗余,避免相同的信息重复使用内存。实验结果表明,对于普通的SCL 文件,使 用基于二叉平衡查找树的改进算法能在原算法的基础上减少46% ~66% 的内存使用;对于较大的SCL 文件,使用 基于散列表的改进算法能在原算法的基础上减少40% ~59. 8% 的内存使用;2 种针对不同大小SCL 文件的改进算 法,能够在保证SCL 文件解析速度的前提下,有效减少DOM 算法的内存消耗。

关键词: 文档对象模型, 变电站配置描述语言, 数据结构, 索引, 解析速度, 内存使用率

Abstract: The traditional method of parsing Substation Configuration Description Language ( SCL) files based on Document Object Model(DOM) expands the whole file in memory and makes a tree structure which has the defect of height memory utilization. According to the redundancy of text nodes information in SCL,improved algorithms are proposed by using the data structures of dynamic array,hash table and binary balance search tree to build index for the text nodes. Experimental results show that the DOM algorithm based on binary balance search tree can reduce 46% ~66% of the memory utilization for the common SCL files,and the DOM algorithm based on hash table can cut down 40% ~ 59. 8% of the bigger SCL files. The two improved algorithms all perform well in reducing the memory utilization of parsing SCL files on the premise of guarantee the SCL file parsing speed.

Key words: Document Object Model(DOM), Substation Configuration Description Language(SCL), data structure, index;parsing speed, memory utilization

中图分类号: