• <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
    主站蜘蛛池模板: 中文字幕日韩精品有码视频| 佐藤遥希在线播放一二区 | 国内精品九九久久久精品| 91麻豆精品一二三区在线| 国内精品久久久久影院一蜜桃| 久久久久国产成人精品亚洲午夜| 8x福利精品第一导航| 亚洲精品高清在线| 国产午夜亚洲精品国产成人小说| 国产福利91精品一区二区三区| 亚洲AV无码精品色午夜在线观看| 久久久91人妻无码精品蜜桃HD | 久久精品国产一区二区三区日韩| 久久精品人人做人人爽97| 拍国产乱人伦偷精品视频 | 永久免费精品视频| 国产午夜精品理论片久久影视| 人妻精品久久久久中文字幕69| 亚洲精品国产自在久久| 国产精品国产三级国产AⅤ| 久久精品国产99国产精偷| 国产精品久久久久久影院| av国内精品久久久久影院| 精品无人区一区二区三区| 亚洲中文字幕无码久久精品1 | 欧美精品第一页| 国产一区二区精品久久| 国产精品毛片VA一区二区三区| 久久亚洲国产成人精品性色| 亚洲精品乱码久久久久久自慰| 亚洲成人国产精品| 亚洲精品动漫人成3d在线| 中文字幕在线精品视频入口一区| 亚洲电影日韩精品 | 国产精品第一区第27页| 九九热精品在线| 久久国产成人精品麻豆| 88国产精品无码一区二区三区 | 国产精品久久久久…| 国产精品久久网| 九九热在线精品视频|