嵌套的xml在vb.net中读写 [英] nested xml read and write in vb.net

查看:70
本文介绍了嵌套的xml在vb.net中读写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI ALL,

需要读取嵌套的xml并存储在datatable中并从vb.net中的datatable xml文件中写入。文件格式如下



 <  联系人 >  
< 1 >
< 名字 > FN < / firstname >
< 姓氏 > LN < / lastname >
< 地址 >
< add1 > A1 < / add1 >
< add2 > A2 < / add2 >
< add3 > A3 < / add3 >
< / address >
< city > NY < / city >
< country > USA < span class =code-keyword>< / country >

< 2 >
< firstname > FN1 < / firstname >
< lastname > LN1 < / lastname
>
< address >
< add1 > A11 < / add1 >
< add2 > A21 < / add2 >
< add3 > A31 < / add3 >
< / address >
< city > NY < / city >
< country > USA < / country >

< < span class =code-leadattribute> / contacts >



请求立即支持。谢谢

解决方案

看起来无效 XML < 1> < 2> 标签未关闭(相同的标签包含无效名称)。

您可以自动加载有效使用 DataSet.ReadXml < XML 文件到数据集中/ a> [ ^ ]方法。

HI ALL,
need to read nested xml and store in datatable and write from datatable xml file in vb.net. file format is below

<contacts>
    <1>
    <firstname> FN </firstname>
    <lastname> LN </lastname>
    <address>
   <add1>A1</add1>
   <add2>A2</add2>
   <add3>A3</add3>
    </address>
    <city>NY</city>
    <country>USA</country>

    <2>
    <firstname> FN1 </firstname>
    <lastname> LN1 </lastname>
    <address>
   <add1>A11</add1>
   <add2>A21</add2>
   <add3>A31</add3>
    </address>
    <city>NY</city>
    <country>USA</country>

</contacts>


request immediate support. thanks

解决方案

That does not look valid XML: <1> and <2> tags are not closed (the same tags have invalid names).
You may automatically load a valid XML file into a dataset using the DataSet.ReadXml[^] method.


这篇关于嵌套的xml在vb.net中读写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆