请教vb xml问题 大家快来
#Region "生成XML文件,并将HTML字符串保存进XML文件"
Public Shared Function SaveHtmlCode(ByVal Path As String, ByVal strHtmlCode As String, ByRef strFileName As String) As Integer
Dim oPage As System.Web.UI.Page = CType(HttpContext.Current.Handler, Page)
If Directory.Exists(oPage.Server.MapPath(Path.Trim("/"c))) = False Then
Directory.CreateDirectory(oPage.Server.MapPath(Path.Trim("/"c)))
End If
Dim doc As New XmlDocument()
doc.LoadXml("<htmlCode><sourceCode></sourceCode></htmlCode>")
Dim elem As XmlNode = doc.DocumentElement.FirstChild
elem.InnerText = System.Web.HttpContext.Current.Server.HtmlEncode(strHtmlCode)
这里有个问题,elem.InnerText有值 得到了图片的链接地址 跟图片名称等信息。但生成的这个xml文件中 除了
<htmlCode><sourceCode></sourceCode></htmlCode> 这两个节点 再无其他的任何信息者是为什么啊??[color=#FF0000][/color]
strFileName = strFileName & ".xml"
If Directory.Exists(oPage.Server.MapPath(Path)) = False Then
Directory.CreateDirectory(oPage.Server.MapPath(Path))
End If
Try
doc.Save(System.Web.HttpContext.Current.Server.MapPath(Path + strFileName))
Return 1
Catch
Return 0
End Try
End Function
#End Region
为什么 得到了图片相关的信息,xml中没有呢 ??
[解决办法]
代码无任何问题