Foros del Web » Programación para mayores de 30 ;) » Programación General »

Error: carácter inválido

Estas en el tema de Error: carácter inválido en el foro de Programación General en Foros del Web. Hola. He colocado el código de Grabnews ( http://edazzle.net/#grabnews ) en www.granadalinks.com , en la sección que pone 'Noticias (Fuentes RSS)' . Se trata de ...
  #1 (permalink)  
Antiguo 22/02/2005, 13:00
Avatar de mrgubu  
Fecha de Ingreso: febrero-2002
Ubicación: Granada
Mensajes: 431
Antigüedad: 22 años, 2 meses
Puntos: 2
Error: carácter inválido

Hola. He colocado el código de Grabnews (http://edazzle.net/#grabnews ) en www.granadalinks.com, en la sección que pone 'Noticias (Fuentes RSS)' .

Se trata de un código que almacena en una BD archivos RSS-XML y los muestra en HTML

El problema es que muchos de los archivos fuentes RSS parece que traen caracteres raros y da el siguiente error:

"Se encontró un carácter no válido en el contenido del texto.", o en inglés: "An invalid character was found in text content."

Supongo que debe ser un problema de definición de la codificación, pero he probado mil fórmulas y no acierto. A ver si alguien me echa una mano.
  #2 (permalink)  
Antiguo 22/02/2005, 13:34
Avatar de mrgubu  
Fecha de Ingreso: febrero-2002
Ubicación: Granada
Mensajes: 431
Antigüedad: 22 años, 2 meses
Puntos: 2
Por si fuera el xsl, aquí lo dejo:

Código:
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!--   Paul Millar - GrabNews
*    Copyright (C) 2001 - 2004 Paul Millar
*
*   This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   along with this program; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
*   [email protected]
-->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="ISO-8859-1" omit-xml-declaration="yes" indent="yes"/>

<xsl:template match="*">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr>
    <td valign="top">
	  <a style="font-size:13px;font-weight:bold;">
		<xsl:attribute name="href">
		  <xsl:for-each select="*[local-name()='link'] | *[local-name()='channel']/*[local-name()='link']">
		    <xsl:choose>
		      <xsl:when test="@rel='alternate'">
		        <xsl:value-of disable-output-escaping="yes" select="./@href"/>
		      </xsl:when>
		      <xsl:otherwise>
		        <xsl:value-of disable-output-escaping="yes" select="."/>
		      </xsl:otherwise>
		    </xsl:choose>
		  </xsl:for-each>
		</xsl:attribute>
		<xsl:value-of disable-output-escaping="yes" select="*[local-name()='channel']/*[local-name()='title'] | *[local-name()='title']"/>
	  </a>
	  <div class="separador"></div>
	</td>
  </tr>
  <tr>
    <td valign="top"><div style="line-height:15px;">
	
	  <xsl:for-each select="//*[local-name()='item'] | //*[local-name()='entry']">
	  <xsl:if test="position() &lt; 10">
	  <div>
	  <img src="imagenes/item_bullit.gif" width="9" height="9" border="0" alt="" /> <a target="blank">
	  <xsl:attribute name="href">
	  <xsl:for-each select="*[local-name()='link']">
	  <xsl:choose>
	  <xsl:when test="@rel='alternate'">
	  <xsl:value-of disable-output-escaping="yes" select="./@href"/>
	  </xsl:when>
	  <xsl:otherwise>
	  <xsl:value-of select="."/>
	  </xsl:otherwise>
	  </xsl:choose>
	  </xsl:for-each>
	  </xsl:attribute>
	  <xsl:value-of disable-output-escaping="yes" select="*[local-name()='title']"/>
	  </a>
	  </div>
	  </xsl:if>
	  </xsl:for-each>
	  </div>
	
	<div align="right"><a href="http://www.edazzle.net/#grabnews" target="blank" title="powered by grabnews">?</a></div>
	</td>
  </tr>
</table>
</xsl:template>

<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>

</xsl:stylesheet>
  #3 (permalink)  
Antiguo 22/02/2005, 16:38
Avatar de mrgubu  
Fecha de Ingreso: febrero-2002
Ubicación: Granada
Mensajes: 431
Antigüedad: 22 años, 2 meses
Puntos: 2
A veces, en lugar del error descrito arriba, me da el error:

'Invalid at the top level of the document.'
  #4 (permalink)  
Antiguo 23/02/2005, 16:53
Avatar de mrgubu  
Fecha de Ingreso: febrero-2002
Ubicación: Granada
Mensajes: 431
Antigüedad: 22 años, 2 meses
Puntos: 2
Por fin encontré la solución:

http://p2p.wrox.com/topic.asp?TOPIC_ID=7695
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:02.