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

//創建根節點 System.Xml.XmlNode root = doc.CreateNode(System.Xml.XmlNodeType " /> 动漫美女的禁,亚洲精品一区三区三区在线观看 ,把内衣脱了把奶露出来

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

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

C#: 

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

//創建根節點 
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); 

//為節點添加屬性 
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); 

//為節點增加值 
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 = "歡迎光臨【孟憲會之精彩世界】"; 

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

//添加節點聲明 
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); 

//查詢節點 
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/"; 

//創建CDATA節點 
System.Xml.XmlCDataSection xcds = doc.CreateCDataSection("<a href='http://dotNET.ASPx.cc/'>【孟憲會之精彩世界】</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

'創建根節點 
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)

'為節點添加屬性 
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)

'為節點增加值 
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 = "歡迎光臨【孟憲會之精彩世界】"

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

'添加節點聲明 
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)

'查詢節點 
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/"

'創建CDATA節點 
Dim xcds As System.Xml.XmlCDataSection = doc.CreateCDataSection("<a href='http://dotNET.ASPx.cc/'>【孟憲會之精彩世界】</a>")
node.ParentNode.InsertAfter(xcds, node)

Response.Write(xcds.InnerText)

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

AspNet技術asp.net下創建、查詢、修改帶名稱空間的 XML 文件的例子,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 久久亚洲AV成人无码国产漫画 | 四虎精品久久 | 翘臀少妇被扒开屁股日出水爆乳 | 亚洲福利电影一区二区? | 99久久99久久久精品齐齐鬼色 | 亚洲国产精品免费观看 | 久久热r在线视频精品 | OLDMAN老头456 TUBE | 自拍 偷拍 亚洲 经典 | 成人毛片100部免费看 | 国产乱码一区二区三区 | 18国产精品白浆在线观看免费 | 国产精品婷婷久青青原 | 亚洲视频免费观看 | 亚洲国产成人久久精品影视 | 久久re视频这里精品09免费 | 美女胸被男子强捏视频 | 国产跪地吃黄金喝圣水合集 | 国产精品无码人妻在线 | 日韩高清一区二区三区不卡 | 亚洲色图在线视频 | 999视频在线观看 | 激情丛林电影完整在线 | 欧美日韩中文字幕综合图区 | 国产精品久免费的黄网站 | 日本少妇内射视频播放舔 | 亚洲国产欧美国产综合在线 | 别停好爽好深好大好舒服视频 | 日本毛片久久国产精品 | 日本夜夜夜 | gogo亚洲肉体艺术照片9090 | 国产精华av午夜在线观看 | 老师xxxx69动漫 | 试看2分钟AA片| 久久AV国产麻豆HD真实 | 日韩欧美 亚洲视频 | 日本妈妈xxxx | 色婷婷五月综合久久中文字幕 | 蜜芽丅v新网站在线观看 | 婚后被调教当众高潮H喷水 回复术士勇者免费观看全集 | 色老99九久精品偷偷鲁 |