Click here to Skip to main content
16,006,001 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionMouselick Event Pin
Manithar13-Nov-06 16:12
Manithar13-Nov-06 16:12 
AnswerRe: Mouselick Event Pin
Not Active13-Nov-06 16:16
mentorNot Active13-Nov-06 16:16 
QuestionHow to access cell values in GridView in edit mode? Pin
HappyASPNETCoding13-Nov-06 15:08
HappyASPNETCoding13-Nov-06 15:08 
QuestionButton Click Pin
shapper13-Nov-06 13:57
shapper13-Nov-06 13:57 
AnswerRe: Button Click Pin
Not Active13-Nov-06 16:07
mentorNot Active13-Nov-06 16:07 
Questioncalendar deselect date Pin
ozeegers13-Nov-06 12:40
ozeegers13-Nov-06 12:40 
AnswerRe: calendar deselect date Pin
minhpc_bk13-Nov-06 13:56
minhpc_bk13-Nov-06 13:56 
QuestionCan't display file in Browser. Need help please! Thank you. Pin
shapper13-Nov-06 12:19
shapper13-Nov-06 12:19 
Hello,

I am trying to convert an Asp.Net XML sitemap file in a Google XMl sitemap file using a XSL file using an HttpHandler.

Everything seems well in my code but I am getting an error:

XML Parsing Error: not well-formed
Location: http://localhost:1132/WebSite/Google
Line Number 2, Column 62:<urlset xmlns="http://www.google.com/schemas/sitemap/0.84" />

I tried to display it as Text instead of Text/XML. I don't get the same error. I just get a bunch of squares after the line:

Line Number 2, Column 62:<urlset xmlns="http://www.google.com/schemas/sitemap/0.84" />

Could somebody help me out? I tried everything I could think of for the past 2 days.

I post my entire code in this post.

Thanks,

Miguel

--------- HttpHandler --------

Public Class SiteMap : Implements IHttpHandler

' -- [Methods] -------------------------------------------

' Define handler process request
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

' Create ASP.NET web site map
Dim webSiteMap As XmlDocument = New XmlDocument

' Load ASP.NET's site map
webSiteMap.Load(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings("~/Web.sitemap"))

' Create google xsl document
Dim googleXsl As XslCompiledTransform = New XslCompiledTransform

' Load google xml document
googleXsl.Load(HttpContext.Current.Server.MapPath("~/SiteMap.xsl"))

' Create xsl arguments list
Dim googleXslArguments As XsltArgumentList = New XsltArgumentList
googleXslArguments.AddParam("Domain", "", "http://www.domain.com")

' Create the ASP.NET's site map memory stream
Dim webSiteMapStream As MemoryStream = New MemoryStream

' Transform Asp.Net's site map to Google's site map and add it to stream
googleXsl.Transform(webSiteMap, googleXslArguments, webSiteMapStream)

' Output Google sitemap
context.Response.Clear()
context.Response.ContentType = "text/xml; charset=utf-8"
context.Response.Write(Encoding.UTF8.GetString(webSiteMapStream.GetBuffer))
context.Response.End()

End Sub

' Define is handler is reusable
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property

End Class

--------- XSL --------

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:dk="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="By27.WebSite.Url"/>
<xsl:template match="dk:*"/>
<xsl:template match="@*|text()|comment()"/>
<xsl:template match="/">
<xsl:element name="urlset">
<xsl:apply-templates select="//dk:siteMapNode[@google='true']"/>
</xsl:element>
</xsl:template>
<xsl:template match="dk:siteMapNode">
<xsl:element name="url">
<xsl:element name="loc">
<xsl:value-of select="$Domain" />
<xsl:value-of select="substring(@url, 3)"/>
</xsl:element>
<xsl:element name="lastmod">
<xsl:value-of select="@lastmod"/>
</xsl:element>
<xsl:element name="changefreq">
<xsl:value-of select="@changefreq"/>
</xsl:element>
<xsl:element name="priority">
<xsl:value-of select="@priority"/>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
QuestionEmbed resource Pin
shapper13-Nov-06 10:47
shapper13-Nov-06 10:47 
AnswerRe: Embed resource Pin
Not Active13-Nov-06 16:13
mentorNot Active13-Nov-06 16:13 
QuestionLogin Pin
eagertolearn13-Nov-06 6:57
eagertolearn13-Nov-06 6:57 
AnswerRe: Login Pin
Sam Heller13-Nov-06 13:02
Sam Heller13-Nov-06 13:02 
GeneralRe: Login Pin
Not Active13-Nov-06 16:10
mentorNot Active13-Nov-06 16:10 
QuestionASP.Net 1.1 with AJAX Pin
madnar13-Nov-06 6:55
madnar13-Nov-06 6:55 
AnswerRe: ASP.Net 1.1 with AJAX Pin
indianet13-Nov-06 8:03
indianet13-Nov-06 8:03 
GeneralRe: ASP.Net 1.1 with AJAX Pin
Sam Heller13-Nov-06 12:51
Sam Heller13-Nov-06 12:51 
QuestionCatching Embedded Events Pin
Sam Heller13-Nov-06 6:07
Sam Heller13-Nov-06 6:07 
AnswerRe: Catching Embedded Events Pin
indianet13-Nov-06 8:14
indianet13-Nov-06 8:14 
QuestionCreate DataGrid from Excel File Pin
alexfromto13-Nov-06 5:59
alexfromto13-Nov-06 5:59 
AnswerRe: Create DataGrid from Excel File Pin
Sam Heller13-Nov-06 6:10
Sam Heller13-Nov-06 6:10 
GeneralRe: Create DataGrid from Excel File Pin
alexfromto13-Nov-06 6:16
alexfromto13-Nov-06 6:16 
GeneralRe: Create DataGrid from Excel File Pin
Sam Heller13-Nov-06 12:48
Sam Heller13-Nov-06 12:48 
GeneralRe: Create DataGrid from Excel File Pin
alexfromto14-Nov-06 3:05
alexfromto14-Nov-06 3:05 
GeneralRe: Create DataGrid from Excel File Pin
alexfromto14-Nov-06 3:22
alexfromto14-Nov-06 3:22 
QuestionWill I be limited by Crystal Reports licensing for this issue? Pin
Goalie3513-Nov-06 5:54
Goalie3513-Nov-06 5:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.