一:XmlWriter的形式
Dim myXmlSettings As New XmlWriterSettings
myXmlSettings.Indent = True
myXmlSettings.NewLineOnAttributes = True
Using ProductWriter As XmlWriter = XmlWriter.Create("path\XMLFile2.xml", myXmlSettings)
ProductWriter.WriteComment("product product ")
ProductWriter.WriteStartElement("All")
ProductWriter.WriteStartElement("Product")
ProductWriter.WriteAttributeString("Id", "101")
ProductWriter.WriteAttributeString("COunt", "10")
ProductWriter.WriteElementString("P1", "P2")
ProductWriter.WriteEndElement()
ProductWriter.WriteStartElement("Product")
ProductWriter.WriteAttributeString("Id", "102")
ProductWriter.WriteAttributeString("COunt", "10")
ProductWriter.WriteElementString("P1", "P2")
ProductWriter.WriteEndElement()
ProductWriter.WriteStartElement("Product")
ProductWriter.WriteAttributeString("Id", "103")
ProductWriter.WriteAttributeString("COunt", "10")
ProductWriter.WriteElementString("P1", "P2")
ProductWriter.WriteEndElement ()
ProductWriter.WriteEndElement()
End Using
二:XmlDocument的形式
Dim Doc As New XmlDocument()
Dim dec As XmlDeclaration = Doc.CreateXmlDeclaration("1.0", _
Nothing, Nothing)
Doc.AppendChild(dec)
Dim DocRoot As XmlElement = Doc.CreateElement("Orders")
Doc.AppendChild(DocRoot)
Dim Order As XmlNode = Doc.CreateElement("Order")
newAtt = Doc.CreateAttribute("Quantity")
newAtt.Value = "100"
Order.Attributes.Append(newAtt)
DocRoot.AppendChild(Order)
Doc.Save("path\XMLFile2.xml")
分享到:
相关推荐
通过vb.net对xml文件进行创建、插入、修改和删除操作,代码简洁,针对性强。
VB.net读写XML文件源代码,此项目源代为DLL形式,在调用时需注意函数接口
VB.net读取XML标签值,两种方法,一是加载XML字符串,一是加载XML文件,然后再从节点路径中读TAG第一个匹配值
VB6和VB.NET中的XML的读写操作.doc 。介绍了vb6和vb.net怎么读写xml格式的文件。
在VB.net环境下实现如何读取一个xml文件的例程。
VB。NET2005 实现程序创建XML文档
vb.net操作XML文件,读取编辑删除添加XML文件操作
VB.NET XML文件的读取,把XML读入DataGrid中,并把数据写入XML文件中
VB.Net读取ini文件的例子,和读取xml文件的例子。两种方法的比较。建议还是用Xml比较好。System.Xml
收集的一个VB.NET 读取写入XML文件的类,做了一些修改,希望能对大家有所帮助!
VB.NET XML和JSON序列化与反序列化,根据实体类可以快速解析XML和json文件,和生成xml,json文件
主要是今天又有网友问类似的xml文件读取问题。 找不到源代码和xml文件和读取后的界面。重新写一个,于是上传到这里来了。主要看form2.vb。 或者查看:http://blog.csdn.net/linjimu/archive/2009/08/19/4463713.aspx
VB.net 开发的一款 XML文件编辑器 .net1.0 框架的
vb.net写的webservice接口,对端发送string形式的XML文件后,本程序进行相应的数据提取存储到数据库后,返回一个XML
Office XP 以及 VS.NET,这个编辑器 可以支持书写 C#、ASP.NET、ADO.NET、XML、HTML 等多种代码, 支持基 于项目或者是文件的开发,可以对 C#、HTML、ASP、ASP.NET、VB.NET、V Bscript、XML 提供彩色语法...
支持最新的Visual Studio功能 - 支持最新的VB.Net / C#功能,包括Await / Async,隐式行继续,多行Lambdas,Nullable可选参数,LINQ,XML,WPF,Lambda表达式和扩展方法。在转化过程中,保留了原有的注释和变量名。...
这是一个利用VB.NETXML 文件编辑器与源代码(VB.Net)源代码,大家可以参考学习。
MD5 skey8位加密(文件)/obj/Debug/MD5 skey8位加密(文件).xml MD5 skey8位加密(文件)/obj/Debug/TempPE/ MD5 skey8位加密(文件)/obj/Debug/TempPE/My Project.Resources.Designer.vb.dll MD5 skey8位加密...
vb.net读写文件,C#创建XML文档,Net2.0中通过委托和事件进行线程安全的控件访问,FileDirectoryUtility
这是一个用VB.NET开发的应用程序管理工具-类似360桌布助手的某此功能,通过导入保存有常用程序列表的XML文件,来通过程序来管理各应用程序的快捷方式,用户可以把常用的程序收集起来,在这里可以直接双击列表中程序...