Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Can not load XML: An invalid character was found in text content.

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 12/24/2008 4:25:00 PM
alex.zeta wrote:
> Hi to everyone,
> 
> I cannot get the xml content of an rss feed (http://www.motocorse.com/
> rss/full.xml) displayed on the page (http://www.wowline.it/
> default2.asp) because of the error you see in the object.
> 
> The xml has encoding="windows-1252" on it and maybe this is the cause
> of the problem, as the other feeds with encoding="ISO-8859-1" doesn't
> have any problem.
> 
> I cannot change the xml feed because it's on another server, and this
> one is the asp code I use to access the xml (URLtoRSS is the variable
> containing the url):
> 
> Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
> xmlHttp.Open "GET", URLToRSS, false
> xmlHttp.Send()
> RSSXML = xmlHttp.ResponseText
> 
> Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")
> xmlDOM.async = False
> xmlDOM.validateOnParse = False
> xmlDom.resolveExternals = False
> 
> If not xmlDOM.LoadXml(RSSXML) Then
> ErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason
> & vbCRLF & ErrorMessage
> End If

Well the problem is simply that you don't use xmlHttp.responseXML but 
instead try to parse the responseText again.
You simply need to use

Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
xmlHttp.Open "GET", URLToRSS, false
xmlHttp.Send()


Set xmlDOM = xmlHttp.responseXML


and that's it, the XMLHTTP object has already done all the work, there 
is no need to use responseText and feed that to the loadXML method.



-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent