如何得到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("'", "")
原文地址:http://dotnet.aspx.cc/article/3b4d3995-7fdf-456f-edc1-9849693aa439/print.aspx
© 版权所有 【孟宪会之精彩世界】TM 2012