VB.net 读写 XML 的类
VB.net 读写 XML 的类... Public Class Xml_ClsClass Xml_Cls Public ReadOnly Property XmlFileName()Property XmlFileName() As String Public ReadOnly Property XmlText()Property XmlText() As String Sub New()Sub New(ByVal FileName As String,Optional ByVal CreateNew As Boolean = True,Optional ByVal Root As String = "XML",Optional ByRef IsOK As Boolean = False) Dim reader As System.Xml.XmlReader = Nothing Public Function Create()Function Create(ByVal FileName As String,Optional ByVal Root As String = "XML") As Boolean Try NewXML.Formatting = Formatting.Indented NewXML.WriteStartElement(Root) NewXML.WriteAttributeString("Powered","Null") NewXML.WriteEndElement() NewXML.Flush() End Try Return True Public Function Save()Function Save(ByVal aSection As String,ByVal aKey As String,ByVal aValue As String) As Boolean Dim Node,Node2 As XmlNode While Strings.Left(aSection,1) = "/" '段名是否为空 Paths = Strings.Split(aSection,"/") If Node Is Nothing Then For n = 1 To Paths.Length - 1 Node2 = Node.SelectSingleNode(Paths(n)) If Ele Is Nothing Then XmlDoc.Save(XmlFile) Public Function Read()Function Read(ByVal aSection As String,Optional ByVal aDefaultValue As String = "") As String Dim Node As XmlNode Node = (XmlDoc.DocumentElement).SelectSingleNode(aSection & "/" & aKey) If Node Is Nothing Then Return aDefaultValue Return Node.InnerText End Function End Class (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 在Perl中,如何将几个文件的内容“slurp”到一个字符串中?
- Delphi数据库技术中Disablecontrols和Enablecontrols的功能
- ThinkPHP3.1快速入门(12)自动验证
- delphi – InputBuffer中的Indy TCPClient和流氓字节
- 数组 – 如何删除数组的前五个元素?
- [VB.NET]关于远程连接数据库的问题*(在线等)
- Golang之bytes.buffer
- 如何使用golang在mongodb中找到并修改一条记录?
- Delphi 中的 XMLDocument 类详解(6) - 访问节点属性
- delphi – 如何检测字符串是否为Base64Encoded?