http://taskcn.blog. 163.com/
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) ;http://taskcn.blog. 163.com/
http://taskcn.blog. 163.com/
//为节点增加值
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/' /anode.ParentNode. InsertAfter(xcds, node) ;
Response.Write(xcds. InnerText) ;doc.Save(Server.MapPath("test.xml") ) ;http://taskcn.blog. 163.com/
http://taskcn.blog. 163.com/
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.XmlAttributexa = 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)http://taskcn.blog. 163.com/
http://taskcn.blog. 163.com/
'为节点增加值
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") )http://taskcn.blog. 163.com/
俄罗斯vps速度怎么样?俄罗斯vps云主机节点是欧洲十大节点之一,地处俄罗斯首都莫斯科,网络带宽辐射周边欧洲大陆,10G专线连通德国法兰克福、法国巴黎、意大利米兰等,向外连接全球。俄罗斯vps云主机速度快吗、延迟多少?由于俄罗斯数据中心出口带宽充足,俄罗斯vps云主机到全球各地的延迟、速度相对来说都不错。今天,云服务器网(yuntue.com)小编介绍一下俄罗斯vps速度及俄罗斯vps主机推荐!俄...
想必我们有一些朋友应该陆续收到国内和国外的域名注册商关于域名即将涨价的信息。大概的意思是说从9月1日开始,.COM域名会涨价一点点,大约需要单个9.99美元左右一个。其实对于大部分用户来说也没多大的影响,毕竟如今什么都涨价,域名涨一点点也不要紧。如果是域名较多的话,确实增加续费成本和注册成本。今天整理看到Dynadot有发布新的八月份域名优惠活动,.COM首年注册依然是仅需48元,本次优惠活动截止...
麻花云在7月特意为主机测评用户群定制了促销活动:香港宽频CN2云服务器、安徽移动云服务器(BGP网络,非单线,效果更好)、安徽移动独立服务器、安徽电信独立服务器,全部不限制流量,自带一个IPv4,默认5Gbps的DDoS防御。活动链接:https://www.mhyun.net/act/zjcp特价云服务器不限流量,自带一个IPv4,5Gbps防御香港宽频CN2全固态Ⅲ型 4核4G【KVM】内存:...