• <fieldset id="8imwq"><menu id="8imwq"></menu></fieldset>
  • <bdo id="8imwq"><input id="8imwq"></input></bdo>
    最新文章專(zhuān)題視頻專(zhuān)題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專(zhuān)題1關(guān)鍵字專(zhuān)題50關(guān)鍵字專(zhuān)題500關(guān)鍵字專(zhuā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)鍵字專(zhuān)題關(guān)鍵字專(zhuān)題tag2tag3文章專(zhuān)題文章專(zhuān)題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專(zhuān)題3
    問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
    當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

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

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

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

    asp.net下創(chuàng)建、查詢、修改帶名稱(chē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)建、查詢、修改帶名稱(chē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 = "歡迎光臨【孟憲會(huì)之精彩世界】"; 

    //添加到內(nèi)存樹(shù)中 
    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 = "歡迎光臨【孟憲會(huì)之精彩世界】: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 = "歡迎光臨【孟憲會(huì)之精彩世界】"

    '添加到內(nèi)存樹(shù)中 
    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 = "歡迎光臨【孟憲會(huì)之精彩世界】: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)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

    文檔

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

    asp.net下創(chuàng)建、查詢、修改帶名稱(chē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)建 修改
    • 熱門(mén)焦點(diǎn)

    最新推薦

    猜你喜歡

    熱門(mén)推薦

    專(zhuān)題
    Top
    主站蜘蛛池模板: 99久久国产综合精品五月天喷水 | 66精品综合久久久久久久| 久久亚洲av无码精品浪潮| 99re6在线精品免费观看| 无码人妻精品一区二| 精品成人一区二区三区四区 | 婷婷五月深深久久精品| 久久精品国产69国产精品亚洲| 国产乱子伦精品无码专区| 国产短视频精品一区二区三区| 国产午夜精品一区二区三区小说| 一级做a爰黑人又硬又粗免费看51社区国产精品视 | 久久精品无码午夜福利理论片| 国产综合色产在线精品| 尤物国产在线精品福利一区| 久久国产精品波多野结衣AV| 国产成人精品一区在线| 久久国产精品久久| 亚洲欧美国产精品第1页| 麻豆精品视频在线观看| 国产精品偷窥熟女精品视频| 久久青青草原精品国产| 一本久久a久久精品亚洲| 日本一区二区三区精品国产| 黑巨人与欧美精品一区 | 小辣椒福利视频精品导航| 国产成人无码精品久久久免费| 久久99国产精品久久99| 亚洲高清国产拍精品26U| 亚洲午夜成人精品电影在线观看 | 亚洲αv在线精品糸列| 最新国产精品精品视频| 伊人久久无码精品中文字幕| 四虎永久在线精品国产馆V视影院| 久久久精品人妻无码专区不卡| 久久www免费人成精品香蕉| 国产精品麻豆高清在线观看| 91精品国产福利在线导航| 99久久99这里只有免费的精品| 中文精品99久久国产 | 久久国产精品成人片免费|