<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
        主站蜘蛛池模板: 亚洲AV日韩AV高潮无码专区| 四虎AV永久在线精品免费观看| 日韩亚洲变态另类中文| 国产精品亚洲а∨无码播放不卡| 免费无码AV电影在线观看| 亚洲午夜精品一区二区公牛电影院| 日韩精品久久久久久免费| 亚洲综合久久综合激情久久| 99视频免费播放| 亚洲中文字幕久在线| 最近最好的中文字幕2019免费| 亚洲日本中文字幕天天更新| 成人永久免费高清| 黄色一级视频免费| 亚洲人成网站在线播放vr| 老司机69精品成免费视频| 亚洲精品视频在线观看免费| 国产精品免费观看久久| 国产AV日韩A∨亚洲AV电影 | 日本特黄特色AAA大片免费| 亚洲男人的天堂一区二区| 国产成人免费AV在线播放| 亚洲韩国—中文字幕| 青青草a免费线观a| 亚洲爆乳少妇无码激情| 国产gv天堂亚洲国产gv刚刚碰| 久久免费观看国产精品| 亚洲日韩国产二区无码| 在线观看亚洲精品福利片| 91av在线免费视频| 国产一区二区三区亚洲综合 | 精品亚洲麻豆1区2区3区| 国产精品免费观看久久| 一区二区免费国产在线观看| 亚洲bt加勒比一区二区| 日韩免费视频播放| 国产成人一区二区三区视频免费| 学生妹亚洲一区二区| 中文字幕亚洲第一| 大地资源免费更新在线播放| 最近免费中文字幕中文高清 |