max 中 dotnet 中实现保保存xml 数据
2013-03-08 11:36
316 查看
-- 把数据保存成 xml 格式 fn bipXml bipPaths frames filePath= ( if bipPaths.count >0 then ( XmlDocumentXDoc = dotNetobject "System.Xml.XmlDocument" dotnetPath = dotNetClass "System.IO.Path" dotnetDirectory =dotNetClass "System.IO.Directory" dotnetFile = dotNetClass "System.IO.File" DirFile =dotnetPath.GetDirectoryName (filePath) if dotnetDirectory.Exists (DirFile) then --尊在不存在都要进行 这里应该判断目录是不是存在 ( --- 第一个节点在外边建立 dotnetNode = XmlDocumentXDoc.CreateNode ((dotNetClass "System.Xml.XmlNodeType").Element) "Url:bipdate" "Url:date" dotnetNode.InnerText ="" XmlDocumentXDoc.AppendChild (dotnetNode) --fileName = dotnetPath.GetFileName(filePath) 这里不是用于到这里 而是加入bipPaths 数据 for i in 1 to bipPaths.count do ( --- 在这里建立字符串 ---建立元素 dotnetXmlElement = XmlDocumentXDoc.CreateElement("node") dotnetXmlElement.InnerText = bipPaths[i]--- 元素的数据进行保存处理 --- 建立属性 ---1. bip的名称 2.开始的帧数 bipFileName = dotnetPath.GetFileName(bipPaths[i]) XmlAttributer = XmlDocumentXDoc.CreateAttribute ("bipname") XmlAttributer.InnerXml = bipFileName ---建立第一个属性 -- 元素加入第一个属性 dotnetXmlElement.SetAttributeNode (XmlAttributer) ---建立第二个属性帧数 //该属性可写入0 帧 可以不写 if frames.count ==0 then ( XmlAttributerFrame = XmlDocumentXDoc.CreateAttribute("frame") XmlAttributerFrame.InnerXml = "0" dotnetXmlElement.SetAttributeNode XmlAttributerFrame )else ( XmlAttributerFrame = XmlDocumentXDoc.CreateAttribute("frame") XmlAttributerFrame.InnerXml = frames[i] as string dotnetXmlElement.SetAttributeNode XmlAttributerFrame ) --- 上面是一个元素两个属性建立模型完成 下面就是把 节点元素 插入到 根节点中 ---上面一键加入了子 应该是在第一个元素下加入 DocumentElement XmlDocumentXDoc.DocumentElement.AppendChild (dotnetXmlElement) ) --- 组后对根节点进行保存处理 XmlDocumentXDoc.save(filePath) ) ) )
相关文章推荐
- javascript 读取XML数据,在页面中展现、编辑、保存的实现
- 保存xml数据到数据库的程序实现
- Android开发实现读取excel数据并保存为xml的方法
- 读取XML数据,在页面中展现、编辑、保存的实现
- javascript 读取XML数据,在页面中展现、编辑、保存的实现
- winForm中DataSet实现数据查询、保存和删除
- xml保存数据
- 用法拉电容从容实现单片机掉电数据保存
- SharedPreferences android将数据存入XML文件里实现记住密码和免登陆前奏(一)
- 利用userData实现客户端保存表单数据
- WebService CXF框架的使用(实现JSON与XML数据传输)
- C#使用XmlEDocument实现数据文件安全存储功能
- 《EasyUI + MVC + EF +WCF》——实现对Datagrid中数据的批量修改或保存
- 利用fragmentManager实现tabhost效果同时保存fragment中数据
- Ajax 实现在WebForm中拖动控件并即时在服务端保存状态数据 (Asp.net 2.0)(示例代码下载)
- 如何实现添加多条信息到GridView中,而一次保存到数据库,不被页面刷新而丢失数据呢?
- 如何用XML实现高效管理数据
- 实现从“环信”下载聊天记录,显示在本地项目页面的功能(三)—— 将解析后的数据保存到本地DB中
- 基于Android XML解析与保存的实现