parse error xml load document asp.net
Hey ASP.NET Wizards,
I am very unsophisticated, so apologies in advance for the simplicity of this problem. I am parsing xml feeds with asp.net. This week one of the RSS XML feeds from remote web site went out and threw my whole page out. I would like to error check the xml before I transform it and send it through. The code is basic. Can I do this on my transform xsl stylesheet? Below is the code and below that is the xsl stylesheet. Thanks,
<script runat="server">
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim doc2 As System.Xml.XmlDocument = New System.Xml.XmlDocument()
doc2.Load("http://www.michellemalkin.com/index.xml")
xmlRss2.Document = doc2
xmlRss2.TransformSource = "rss.xsl"
End Sub
</script>
<html>
<body>
<form runat="server">
<asp:xml id="xmlRss2" runat="server" />
</form>
</body>
</html>
*******style sheet********
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="rss/channel" />
</xsl:template>
<xsl:template match="channel">
<h2>
<a href="{link}" target="_blank"><xsl:value-of select="title" /></a>
</h2>
[list]
<xsl:apply-templates select="item" />
</ul>
</xsl:template>
<xsl:template match="item">
<a href="{link}" target="_blank"><xsl:value-of select="title" /></a>
- <xsl:value-of select="pubDate" />
<br />
<xsl:value-of disable-output-escaping="yes" select="description" />
<p/>
</xsl:template>
</xsl:stylesheet>
|