MsXml创建和解析XML示例

来源:互联网 发布:淘宝小樱牌 编辑:程序博客网 时间:2024/06/07 07:57

一.MsXml创建XML文档示例

 

生成的china.xml文档内容:

二.MsXml解析XML文档示例

 

运行结果如下:

root = China

child[1] of <China>: <Continent>

child[3] of <China>: <Population>

child[5] of <China>: <Municipality>

文档中<Population>共有5

根节点下的<Population>子节点值为1,296

Attr[0] of <Population>: Units = Million Person

Attr[1] of <Population>: StatisticalYear = 2000

childs of <Municipality>: BeiJing

childs of <Municipality>: Area

childs of <Municipality>: Population

childs of <Municipality>: TianJin

childs of <Municipality>: Area

childs of <Municipality>: Population

childs of <Municipality>: ShangHai

childs of <Municipality>: Area

childs of <Municipality>: Population

childs of <Municipality>: ChongQing

childs of <Municipality>: Area

childs of <Municipality>: Population

child[0] of <Municipality>: BeiJing

child[1] of <Municipality>: TianJin

child[2] of <Municipality>: ShangHai

child[3] of <Municipality>: ChongQing

<TianJin>的父节点为<Municipality>

child[0] of <TianJin>: Area

child[1] of <TianJin>: Population

<TianJin>的兄节点为<BeiJing>

<TianJin>的弟节点为<ShangHai>

原创粉丝点击