XML在通用数据交换中的作用
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
XML一出现,就在Web服务以及数据库中得到了充分的应用,并且成为各种应用程序中交换和处理数据的重要格式。本文就XML和数据库尤其是Oracle数据库之间进行数据格式互换,以及在C++应用程序中如何进行XML数据绑定做了全面的论述,体现了XML作为通用的数据交换格式的重要地位。在应用程序中访问XML文档有DOM的树结构,SAX流模型,以及XML数据绑定的方法。前两种方式在XML文档和应用之间批量处理数据时非常麻烦,而数据绑定是处理大量XML数据传输的新方法,目前这种方法也只是在Java中得到了很好的实现。那么,在C++中,只要从XML模式描述结构的基础出发,产生结构的XML模式表示,同时吸取了DOM和SAX表示XML数据的优点,运用类结构空间的新方法,我们实现了把有效的XML文档绑定到结构。在C++程序中,只要通过调用通用的打包和解包接口函数,解决了结构实例和XML文档数据之间的直接转换。该方法的实现,不但节省C++程序的开发成本,提高了效率,而且便于软件的维护。在数据库方面,实现了将XML文档和表中记录格式互换,用于从主表和其所有的子表中,如何以XML文档存取特定记录;以及如何将XML文档数据按照指定的方式存入不同的表中。
XML has been widely used in Web service and in various databases since its appearance. It can be an important data format processed in program. This paper describes the data format inter-conversion between various databases and how to do XML data binding in C++ program. Thus embodies the function of the XML as a universal data inter-conversion format. There are three methods to access XML documents, tree-structure in DOM, stream-model in SAX, and XML data binding. It must probe deeply into XML text nodes when the first two methods are used and thus is a big trouble exchanging huge data among XML documents and applications. Now the data binding method specially used to exchange huge data has been implemented in Java. The valid XML document has been bound to C++ structure with a new method of the structure-like space that is created from the base of the XML schema describing structure. The direct conversion between structure object and the XML document through calling the general interface functions of marshal
    ling and unmarshalling in C++ program. The binding method not only lowers the cost of C++ development and improves the efficiency, but also is convenient for software maintenance. Reading the named records from database tables under the condition of not knowing the reference and storing them in an XML document and storing the XML document in different tables in special way has been implemented.
引文
[1] Stewart Fraser Steven Livingstone. VB.NET XML入门经典.第一版.清华大学出版社,2003.
    [2] Stephen Chelack. Oracle8i与Server 2000集成.第一版.电子工业出版社,2001.
    [3] Mark Birbeck.XML高级编程.第一版.机械工业出版社,2002.
    [4] 王林.数掘库系统原理与应用技术基础(Oracle).第一版.北京希望电子出版社,2003.
    [5] Dennis M. Sosnoski. Java中的XML:使用Castor进行数据绑定.http://www-900.ibm.com/developerWorks/cn/xml/x-bindcastor/index.shtml.
    [6] Brett McLaughlin.从XML到Java代码的数据绑定.http://www.yesky.com/soRChannel.
    [7] 栗松涛.XML程序设计.第一版.清华大学出版社,2000.
    [8] [美]Chuck White等著 周生炳 宋浩 肖伟等译.XML从入门到精通(黄金版).第一版.电子工业出版社,2001.
    [9] 李江 张威 编写.Instant XML/XSL/Java网络编程.第一版.宇航出版社 北京希望电子出版社,2002.
    [10] [美]Fabio Arciniegas著 武磊 刘拴强 译.C++XML高级编程指南.第一版.中国科学出版集团 北京希望电子出版社,2000.
    [11] Richard Anderson Chris Blexrud 著.刘福太 张立民 金慧琴 等译.ASP 3高级编程.第一版.机械工业出版社,2000.
    [12] Aaron Skonnard.XML精要快速参考手册.第一版.人民邮电出版社,2002.
    [13] John E. Swanke. Visual C++MFC 编程实例.第一版.机械工业出版社,2000.
    [14] Stanley B. Lippman Josee Lajoie著 潘爱民 张丽 译.C++Primer.第三版.中国电力出版社,2002.
    [15] Introduction to Data Access with ADO.NET. http://msdn.microsoft.com/library/default.asp.
    [16] Walkthrough: Creating an XML File with an Associated XML Schema. http://msdn.microsoft.com/library/default.asp.
    [17] Mariva H. Aviram. XML和Java:一个强大的组合.http://www.chinajavaworld.net/doc/xml/23.html.
    [18] 钟家豪.Zeus实现XML-JAVA的数据绑定.http://www-900.ibm.com/developerWorks/cn/java/1-Zeus/index.shtml.
    [19] Altova GmbH. XMLSPY. Version 2004 rel 2.
    [20] 数据库与信息交换.http://www.ChinaJavaWorld.com.
    [1] 王永民 韩兵 王力.C++中的XML数据绑定.微机发展.2004,6,第六期.