Hi there
The issue
Need to bring in an XML file to the App that is not in the App root.
Part Solution
I have built an aspx page that will bring in the XML file and 'serve' it
This runs without a problem and shows the XML content
Now I need to to use xml events to get a value from that XML file
Sooooooo the question is how do I create a valid MapPath so that it loads the document correctly?
Dim vmapxmlPath as string = "ServeXML.a spx"
causes an error = it needs to resolve the url to get the file, but I can't figure out the correct syntax....
The issue
Need to bring in an XML file to the App that is not in the App root.
Part Solution
I have built an aspx page that will bring in the XML file and 'serve' it
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim GetFile As String
GetFile = "\\Interclaims1\InterclaimsC\Data\Shared\XML\Parkwood\Newsletter.xml"
If New System.IO.FileInfo(GetFile).Exists Then
Response.Clear()
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches)
Response.ContentType = "text/xml"
Response.ContentEncoding = Encoding.UTF8
Response.WriteFile(GetFile)
Response.End()
End If
End Sub
Now I need to to use xml events to get a value from that XML file
Code:
Dim xmldoc As New XmlDataDocument
Dim vXmlNode As XmlNode
xmldoc.Load(Server.MapPath(vmapxmlpath))
Dim xmlnodelist As XmlNodeList = xmldoc.DocumentElement.SelectNodes("NewsLetter_Data")
For Each vXmlNode In xmlnodelist
Dim vType As Integer = vXmlNode.SelectSingleNode("Newsletter_ID").InnerText
If vType = 2 Then
Dim vReplaceText As New ReplaceText
Dim vConverted As String = vReplaceText.ReturnHTML(vXmlNode("NewsLetter_Body").InnerText)
TextBox1.Text = vConverted
End If
Next
Dim vmapxmlPath as string = "ServeXML.a spx"
causes an error = it needs to resolve the url to get the file, but I can't figure out the correct syntax....
Comment