logo

如何得到XML中xml-stylesheet节点中的href地址?
作者:孟宪会 发表于:2003-10-22 15:53:11

在.NET中如何得到XML中中的href地址呢?其实,XmlDocument里已经包含了其中的信息。下面就是提取的例子,当然用正则表达式更好。

Dim a As New System.Xml.XmlDocument a.LoadXml("<?xml version=""1.0"" encoding=""utf-8""?><?xml-stylesheet type='text/xsl' href='MainMenu.xsl'?><Menus/>") Dim b As System.Xml.XmlProcessingInstruction Dim c As String Dim arr As System.Array b = a.ChildNodes(1) c = b.Value.ToString arr = c.Split(" ") c = arr(1) arr = c.Split("=") c = arr(1) Label1.Text = c.Replace("'", "")