易截截图软件、单文件、免安装、纯绿色、仅160KB

XML解析器,自己加了点注释。留底

#include <iostream>
#include "1.h"
int main(int argc, char *argv[])
{
    try
    {
        SXmlDOM dom;
        //dom.parse("<?xml?><书店><书本 书名="VC++" 价格="50" 折扣="1"/><书本 书名="VB" 价格="50" 折扣="0.8"/><书本 书名="C#" 价格="50" 折扣="0.7">有源程序光盘</书本><挂历><年份>2006</年份><价格>50</价格></挂历></书店>")
        dom.parseFile("test.xml");
        //查询
        SXmlElement& root = dom.root();
        cout << "有" << root.count("书本") << "本书!"<< endl;
        cout << "VB的价格:" << (int)root.item("书本", 1)["价格"] * (float)root.item("书本", 1)["折扣"] << endl;
        cout << root.at(0).xml();
        SXmlElement& gl = root.item("挂历");
        cout << gl.item("年份").text() << endl;
        //遍历
        SXmlNodeList::iterator iter;
        for(iter = root.begin(); iter!=root.end(); iter++)
            cout << (*iter)->xml();
       
        //赋值
        root.item("书本", 1)["价格"] = 60;
        root.item("书本", 1)["折扣"] = 0.5;
        cout << "VB的价格:" << (int)root.item("书本", 1)["价格"] * (float)root.item("书本", 1)["折扣"] << e


相关文档:

Ext.data.Store 读取XML属性值


data.xml
<?xml version="1.0" encoding="UTF-8"?>
<Items>
<Item ASIN="0446355453"
Author="Sidney Sheldon"
Manufacturer="Warner Books"
ProductGroup="Book"
Title="Master of the Game"/>

<Item ASIN=" ......

fw_student_SqlMap.xml(SQL 和VO的映射文件)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="fw_student">
<resultMap class="com.sias.Student" id="student">
<result column="name" property="na ......

Sql 数据导出到XMl 与 从XML导入到数据库

1、导出到XMl select * from Brand  for xml auto ,root('Brands')
<Brands>
  <Brand BrandID="E584596D-4D66-4F2F-B6F7-71C3BEB4CA21" Name="inganico" />
  <Brand BrandID="19B04451-DDC4-4CDF-BE30-CB4E703B27DA" Name="安付达" />
  <Brand BrandID="3C6C8E12-7C4A-4F1 ......

JAVA中读取XML文件中的配置信息

  在进行MIS系统开发过程中,从配置文件中读取配置信息是每一个系统必须具备的功能,例如,我们要配置读取数据库配置信息,包括驱动程序名、连接字符串,用户名,口令等信息,由于这些信息会随着用户的不同而发生改变,所以不能直接把参数写在程序中,将其写入配置文件,然后在应用程序中读取配置信息并加以使用,是一个成 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号