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/25/2008 1:08:00 PM
alex.zeta wrote:

> 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 = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
> xmlHttp.Open "GET", URLToRSS, false
> xmlHttp.Send()
> Set xmlDOM = xmlHttp.responseXML
> 
> If not xmlDOM.LoadXml(RSSXML) Then
> ErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason
> & vbCRLF & ErrorMessage
> End If

What is the LoadXml call good for? You don't have to parse any XML 
response yourself, it is already parsed.
If you want to check for a parseError, fine, then do that as follows:

Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
xmlHttp.Open "GET", URLToRSS, false
xmlHttp.Send()
Set xmlDOM = xmlHttp.responseXML
If xmlDOM.parseError.errorCode <> 0 Then
   'output parseError.reason
Else
   'use xmlDOM here
End If

-- 

	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