Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Can not load XML: An invalid character was found in text content. >Thread Next - Re: Can not load XML: An invalid character was found in text content. Re: Can not load XML: An invalid character was found in text content.To: NULL Date: 12/24/2008 8:58:00 AM On 24 Dic, 16:24, Martin Honnen <mahotr...@yahoo.de> wrote:
> 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=3D"windows-1252" on it and maybe this is the cause
> > of the problem, as the other feeds with encoding=3D"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 =3D Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
> > xmlHttp.Open "GET", URLToRSS, false
> > xmlHttp.Send()
> > RSSXML =3D xmlHttp.ResponseText
>
> > Set xmlDOM =3D Server.CreateObject("MSXML2.DomDocument.3.0")
> > xmlDOM.async =3D False
> > xmlDOM.validateOnParse =3D False
> > xmlDom.resolveExternals =3D False
>
> > If not xmlDOM.LoadXml(RSSXML) Then
> > ErrorMessage =3D "Can not load XML:" & vbCRLF & xmlDOM.parseError.reaso=
n
> > & 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 =3D Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
> xmlHttp.Open "GET", URLToRSS, false
> xmlHttp.Send()
>
> Set xmlDOM =3D 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.
>
> --
>
> =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML
> =A0 =A0 =A0 =A0http://JavaScript.FAQTs.com/
Now I get this essor: XML document must have a top level element.
This is the code I'm using.. (and as you all probably can see, I'm a
newbee about xml-parsing..)
Set xmlHttp =3D Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
xmlHttp.Open "GET", URLToRSS, false
xmlHttp.Send()
Set xmlDOM =3D xmlHttp.responseXML
If not xmlDOM.LoadXml(RSSXML) Then
ErrorMessage =3D "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason
& vbCRLF & ErrorMessage
End If
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
