Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
Posts: 1
Registered: ‎12-03-2009
My Device: Not Specified

Fixing "error encountered during xml parse:"

[ Edited ]

I thought I would share this as I am a web developer and came across this issue. It seems that for the end user you can change your user agent and it will fix this. But for the development side let show you how I fixed it. I had a listing with links that looked like this <a href="default.aspx?cat=1&id=2"> and it was returning the error error encountered during xml parse: Expecting ';'. After searching for a while I was able to find the user agent fixes. Then I got the brillant idea of moving things around, and a little trial by error. I was able to narrow it down to the query string. It seems that  the native blackberry browser reads the & in the links and returns a XML error. By simply escaping the & (&amp;) I was able to get around this error. This seems to be a fairly new error. All, and all, in the end it's an XML Parsing error. As we all know you have to escape entities in XML.

Developer
Posts: 168
Registered: ‎11-01-2008
My Device: Galaxy S II
My Carrier: Meteor (Ireland)

Re: Fixing "error encountered during xml parse:"

What happens if you put a DOCTYPE declaration at the top of the document to say that it is HTML 4.0.1? Perhaps the default is to treat it as XHTML...

Developer
Posts: 168
Registered: ‎11-01-2008
My Device: Galaxy S II
My Carrier: Meteor (Ireland)

Re: Fixing "error encountered during xml parse:"

Specifically, try putting this up there:

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

 

 

Developer
Posts: 107
Registered: ‎09-25-2008
My Device: Not Specified

Re: Fixing "error encountered during xml parse:"

Most desktop browsers (Firefox, Safari, Opera) will also display XML parsing errors if you feed them invalid XML on a page that is served with an XML content-type header. So if you have a page with "Content-type: text/xml" or "Content-type: application/xml" or "Content-type: application/xhtml+xml" or any of the other XML content-types, then they will use a strict XML parser and you will get this error. If you serve the page as text/html then you get the HTML parser (regardless of doctypes) and it will be lax with respect to parsing all sorts of junk.

Highlighted
Developer
Posts: 168
Registered: ‎11-01-2008
My Device: Galaxy S II
My Carrier: Meteor (Ireland)

Re: Fixing "error encountered during xml parse:"

If the page is packaged up inside a widget (I don't thing the OP said) then there won't be any Content-Type header seeing as there's no server. Hence my suggestion that he use a DOCTYPE. I guess putting a meta element in the head would be sensible too.