<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當(dāng)前位置: 首頁 - 科技 - 知識百科 - 正文

        asp.net下創(chuàng)建、查詢、修改帶名稱空間的 XML 文件的例子

        來源:懂視網(wǎng) 責(zé)編:小采 時間:2020-11-27 22:45:35
        文檔

        asp.net下創(chuàng)建、查詢、修改帶名稱空間的 XML 文件的例子

        asp.net下創(chuàng)建、查詢、修改帶名稱空間的 XML 文件的例子:C#: string w3NameSpace = http://www.w3.org/2000/xmlns/; System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); //創(chuàng)建根節(jié)點(diǎn) System.Xml.XmlNode root = doc.CreateNode(System.Xml.Xm
        推薦度:
        導(dǎo)讀asp.net下創(chuàng)建、查詢、修改帶名稱空間的 XML 文件的例子:C#: string w3NameSpace = http://www.w3.org/2000/xmlns/; System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); //創(chuàng)建根節(jié)點(diǎn) System.Xml.XmlNode root = doc.CreateNode(System.Xml.Xm

        C#: 

        string w3NameSpace = "http://www.w3.org/2000/xmlns/"; 
        System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); 

        //創(chuàng)建根節(jié)點(diǎn) 
        System.Xml.XmlNode root = doc.CreateNode(System.Xml.XmlNodeType.Element, "w", "wordDocument", "http://schemas.microsoft.com/office/word/2003/2/wordml"); 
        System.Xml.XmlAttribute xa; 
        xa = doc.CreateAttribute("xmlns", "v", w3NameSpace); 
        xa.Value = "urn:schemas-microsoft-com:vml"; 
        root.Attributes.Append(xa); 

        //為節(jié)點(diǎn)添加屬性 
        xa = doc.CreateAttribute("xmlns", "w10", w3NameSpace); 
        xa.Value = "urn:schemas-microsoft-com:office:word"; 
        root.Attributes.Append(xa); 

        xa = doc.CreateAttribute("xmlns", "SL", w3NameSpace); 
        xa.Value = "http://schemas.microsoft.com/schemaLibrary/2003/2/core"; 
        root.Attributes.Append(xa); 

        xa = doc.CreateAttribute("xmlns", "aml", w3NameSpace); 
        xa.Value = "http://schemas.microsoft.com/aml/2001/core"; 
        root.Attributes.Append(xa); 

        xa = doc.CreateAttribute("xmlns", "wx", w3NameSpace); 
        xa.Value = "http://schemas.microsoft.com/office/word/2003/2/auxHint"; 
        root.Attributes.Append(xa); 

        xa = doc.CreateAttribute("xmlns", "o", w3NameSpace); 
        xa.Value = "urn:schemas-microsoft-com:office:office"; 
        root.Attributes.Append(xa); 

        xa = doc.CreateAttribute("xmlns", "dt", w3NameSpace); 
        xa.Value = "uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"; 
        root.Attributes.Append(xa); 

        xa = doc.CreateAttribute("xmlns", "space", w3NameSpace); 
        xa.Value = "preserve"; 
        root.Attributes.Append(xa); 

        //為節(jié)點(diǎn)增加值 
        System.Xml.XmlNode body = doc.CreateNode(System.Xml.XmlNodeType.Element, "v", "body", "urn:schemas-microsoft-com:vml"); 
        System.Xml.XmlNode childNode = doc.CreateNode(System.Xml.XmlNodeType.Element, "o", "t", "urn:schemas-microsoft-com:office:office"); 
        childNode.InnerText = "歡迎光臨【孟憲會之精彩世界】"; 

        //添加到內(nèi)存樹中 
        body.AppendChild(childNode); 
        root.AppendChild(body); 
        doc.AppendChild(root); 

        //添加節(jié)點(diǎn)聲明 
        System.Xml.XmlDeclaration xd = doc.CreateXmlDeclaration("1.0", "UTF-8", "yes"); 
        doc.InsertBefore(xd, doc.DocumentElement); 

        //添加處理指令 
        System.Xml.XmlProcessingInstruction spi = doc.CreateProcessingInstruction("mso-application", "progid=\"Word.Document\""); 
        doc.InsertBefore(spi, doc.DocumentElement); 

        //查詢節(jié)點(diǎn) 
        System.Xml.XmlNamespaceManager nsmanager = new System.Xml.XmlNamespaceManager(doc.NameTable); 
        nsmanager.AddNamespace("w", "http://schemas.microsoft.com/office/word/2003/2/wordml"); 
        nsmanager.AddNamespace("v", "urn:schemas-microsoft-com:vml"); 
        nsmanager.AddNamespace("o", "urn:schemas-microsoft-com:office:office"); 
        System.Xml.XmlNode node = doc.SelectSingleNode("w:wordDocument/v:body/o:t", nsmanager); 
        Response.Write(node.InnerText); 

        node.InnerText = "歡迎光臨【孟憲會之精彩世界】:http://dotnet.aspx.cc/"; 

        //創(chuàng)建CDATA節(jié)點(diǎn) 
        System.Xml.XmlCDataSection xcds = doc.CreateCDataSection("<a ); 
        node.ParentNode.InsertAfter(xcds, node); 

        Response.Write(xcds.InnerText); 

        doc.Save(Server.MapPath("test.xml")); 

        VB.net

        Dim w3NameSpace As String = "http://www.w3.org/2000/xmlns/"
        Dim doc As New System.Xml.XmlDocument

        '創(chuàng)建根節(jié)點(diǎn) 
        Dim root As System.Xml.XmlNode = doc.CreateNode(System.Xml.XmlNodeType.Element, "w", "wordDocument", "http://schemas.microsoft.com/office/word/2003/2/wordml")
        Dim xa As System.Xml.XmlAttribute
        xa = doc.CreateAttribute("xmlns", "v", w3NameSpace)
        xa.Value = "urn:schemas-microsoft-com:vml"
        root.Attributes.Append(xa)

        '為節(jié)點(diǎn)添加屬性 
        xa = doc.CreateAttribute("xmlns", "w10", w3NameSpace)
        xa.Value = "urn:schemas-microsoft-com:office:word"
        root.Attributes.Append(xa)

        xa = doc.CreateAttribute("xmlns", "SL", w3NameSpace)
        xa.Value = "http://schemas.microsoft.com/schemaLibrary/2003/2/core"
        root.Attributes.Append(xa)

        xa = doc.CreateAttribute("xmlns", "aml", w3NameSpace)
        xa.Value = "http://schemas.microsoft.com/aml/2001/core"
        root.Attributes.Append(xa)

        xa = doc.CreateAttribute("xmlns", "wx", w3NameSpace)
        xa.Value = "http://schemas.microsoft.com/office/word/2003/2/auxHint"
        root.Attributes.Append(xa)

        xa = doc.CreateAttribute("xmlns", "o", w3NameSpace)
        xa.Value = "urn:schemas-microsoft-com:office:office"
        root.Attributes.Append(xa)

        xa = doc.CreateAttribute("xmlns", "dt", w3NameSpace)
        xa.Value = "uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
        root.Attributes.Append(xa)

        xa = doc.CreateAttribute("xmlns", "space", w3NameSpace)
        xa.Value = "preserve"
        root.Attributes.Append(xa)

        '為節(jié)點(diǎn)增加值 
        Dim body As System.Xml.XmlNode = doc.CreateNode(System.Xml.XmlNodeType.Element, "v", "body", "urn:schemas-microsoft-com:vml")
        Dim childNode As System.Xml.XmlNode = doc.CreateNode(System.Xml.XmlNodeType.Element, "o", "t", "urn:schemas-microsoft-com:office:office")
        childNode.InnerText = "歡迎光臨【孟憲會之精彩世界】"

        '添加到內(nèi)存樹中 
        body.AppendChild(childNode)
        root.AppendChild(body)
        doc.AppendChild(root)

        '添加節(jié)點(diǎn)聲明 
        Dim xd As System.Xml.XmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", "yes")
        doc.InsertBefore(xd, doc.DocumentElement)

        '添加處理指令 
        Dim spi As System.Xml.XmlProcessingInstruction = doc.CreateProcessingInstruction("mso-application", "progid=""Word.Document""")
        doc.InsertBefore(spi, doc.DocumentElement)

        '查詢節(jié)點(diǎn) 
        Dim nsmanager As New System.Xml.XmlNamespaceManager(doc.NameTable)
        nsmanager.AddNamespace("w", "http://schemas.microsoft.com/office/word/2003/2/wordml")
        nsmanager.AddNamespace("v", "urn:schemas-microsoft-com:vml")
        nsmanager.AddNamespace("o", "urn:schemas-microsoft-com:office:office")
        Dim node As System.Xml.XmlNode = doc.SelectSingleNode("w:wordDocument/v:body/o:t", nsmanager)
        Response.Write(node.InnerText)

        node.InnerText = "歡迎光臨【孟憲會之精彩世界】:http://dotnet.aspx.cc/"

        '創(chuàng)建CDATA節(jié)點(diǎn) 
        Dim xcds As System.Xml.XmlCDataSection = doc.CreateCDataSection("<a )
        node.ParentNode.InsertAfter(xcds, node)

        Response.Write(xcds.InnerText)

        doc.Save(Server.MapPath("test.xml")) 

        聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        asp.net下創(chuàng)建、查詢、修改帶名稱空間的 XML 文件的例子

        asp.net下創(chuàng)建、查詢、修改帶名稱空間的 XML 文件的例子:C#: string w3NameSpace = http://www.w3.org/2000/xmlns/; System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); //創(chuàng)建根節(jié)點(diǎn) System.Xml.XmlNode root = doc.CreateNode(System.Xml.Xm
        推薦度:
        標(biāo)簽: 查詢 創(chuàng)建 修改
        • 熱門焦點(diǎn)

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 114级毛片免费观看| 久99久无码精品视频免费播放| 小日子的在线观看免费| 亚洲裸男gv网站| 免费无码专区毛片高潮喷水| 国产一级大片免费看| 精品国产日韩亚洲一区在线| 国产成人免费A在线视频| 粉色视频免费入口| 亚洲精品偷拍视频免费观看| 成人片黄网站色大片免费观看cn| 亚洲中文无韩国r级电影| 中国一级毛片视频免费看| 国产亚洲av片在线观看18女人| a级毛片免费全部播放无码| 亚洲情XO亚洲色XO无码| 久久国产免费观看精品| 老司机亚洲精品影院| 国产成人精品免费视频网页大全| 亚洲精品视频观看| 成人免费看片又大又黄| 免费一级毛片在线播放放视频| 国产乱辈通伦影片在线播放亚洲 | 亚洲人成电影网站色www| 日本一道在线日本一道高清不卡免费| 国产精品亚洲精品爽爽| 亚洲综合激情另类专区| 一区二区三区四区免费视频 | 亚洲a视频在线观看| 免费黄色网址入口| 一级女性全黄生活片免费看| 亚洲深深色噜噜狠狠爱网站 | 成人免费在线观看网站| 日韩在线视频线视频免费网站| 国产亚洲精品美女久久久 | 国产一区二区三区免费观在线| 亚洲AV无码久久精品成人| 永久免费av无码网站韩国毛片| 四虎成人精品国产永久免费无码| 国产亚洲人成网站在线观看不卡| 中字幕视频在线永久在线观看免费 |