摘要: 基于文档对象模型(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
中图分类号:
王友钊,温琪,黄静. 基于文档对象模型的改进SCL 文件解析算法[J]. 计算机工程.
WANG You-zhao,WEN Qi,HUANG Jing. Improved SCL File Parsing Algorithm Based on Document Object Model[J]. Computer Engineering.