Create New XML File


DimtmpXmlAsNewXml.XmlDocument
DimtmpNodeAsXml.XmlNode
DimsubNodeAsXml.XmlNode
Dimg_XmlDocAsNewXml.XmlDocument

'初始化XML
tmpXml.LoadXml("<?xmlversion=""1.0""encoding=""GB2312""?><Root></Root>")

'添加用户信息节点"
tmpNode=tmpXml.CreateNode(Xml.XmlNodeType.Element,"User",Nothing)
subNode
=tmpXml.CreateNode(Xml.XmlNodeType.Element,"UserID",Nothing)
subNode.InnerText
="uid"
subNode
=tmpXml.CreateNode(Xml.XmlNodeType.Element,"UserName",Nothing)
subNode.InnerText
="uname"
tmpNode.AppendChild(subNode)
tmpXml.DocumentElement.AppendChild(tmpNode)

'添加用户信息节点
tmpNode=tmpXml.CreateNode(Xml.XmlNodeType.Element,"Shop",Nothing)
subNode
=tmpXml.CreateNode(Xml.XmlNodeType.Element,"ShopID",Nothing)
subNode.InnerText
="shopid"
tmpNode.AppendChild(subNode)
subNode
=tmpXml.CreateNode(Xml.XmlNodeType.Element,"ShopName",Nothing)
subNode.InnerText
="test"
tmpNode.AppendChild(subNode)

tmpXml.DocumentElement.AppendChild(tmpNode)
tmpXml.Save(
"text.xml")
MsgBox("ok")
RESULT:
<?xmlversion="1.0"encoding="GB2312"?>
<Root>
<User>
<UserName>uname</UserName>
</User>
<Shop>
<ShopID>shopid</ShopID>
<ShopName>test</ShopName>
</Shop>
</Root>
C#
Result 优质内容筛选与推荐>>
1、Welcome
2、C#导出Excel总结
3、R绘图导入ppt
4、笔记1
5、ASP.NET MVC URL重写与优化(进阶篇)-继承RouteBase玩转URL


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号





    联系我们

    欢迎来到TinyMind。

    关于TinyMind的内容或商务合作、网站建议,举报不良信息等均可联系我们。

    TinyMind客服邮箱:support@tinymind.net.cn