摘要: 为了实现对XML文档的数据更新,提出一组实用算法。该算法利用简单应用编程接口扩展标记语言(SAX)解析和文件对象模型(DOM)解析,使其优势互补。应用SAX解析器将大XML文档编码成线性数据结构存储,该线性数据结构与原XML文档具有同构特性,因此,线性结构存储的数据可以无损还原为原XML文档。线性数据结构支持Xpath查询,在查询得到的局部数据上应用DOM方法进行数据更新。更新后的数据再转换为XML文档。该组算法对大XML文档的数据更新实用且有效,而且对大XML文档的其他数据处理也有一定的实用价值。
关键词:
扩展标记语言,
数据更新,
SAX解析,
DOM解析
Abstract: This paper proposes a set of algorithms taking advantages of SAX parser and DOM parser for large XML data update. By applying SAX parser, a large XML document is encoded into linearity data structure isomorphic with the XML document. This linearity data can be reverted to the XML document without loss. Xpath query is hold out in the linearity data structure. Use DOM parser to updata the data got from the linearity data structure by Xpath querying. This updated content is inserted into the large XML document by encoding, replacing and reverting operation. This method is practical and effective for large XML document data updating and other data processing as data query.
Key words:
extensible markup language,
data updating,
Simple API for XML(SAX) paser,
Document Object Model(DOM) paser
中图分类号:
鲍培明;吉根林. XML数据更新算法研究[J]. 计算机工程, 2008, 34(4): 101-103.
BAO Pei-ming; JI Gen-lin. Study on Updating XML Data Algorithm[J]. Computer Engineering, 2008, 34(4): 101-103.