Log in

View Full Version : error caused from xml content



I am Abby
06-14-2010, 06:47 PM
If for some reason a " " gets into my xml document (from me accidently hitting the space bar twice or something), when I load the xml onto my web page I get an error that the parser does not know what “&nbsp” is (notice it does not add the “;” even though it is in the xml document with the rest of the space tag)

djr33
06-14-2010, 07:34 PM
It may be somehow messy in the document so that the parser is reading it in the wrong way, or the parser may not handle entities. XML is not XHTML: it's just like a text-file database format, that in some cases happens to be XHTML. But perhaps the parser isn't designed to handle the HTML aspects.
Also, it might just be displaying &nbsp and really be referring to  , but we can't really know that.
I don't see a clear reason for this to happen, but I'd suggest not using entities like that and instead escaping them after you load the XML.

I am Abby
06-21-2010, 08:00 PM
I don't see a clear reason for this to happen, but I'd suggest not using entities like that and instead escaping them after you load the XML.

how would you excape them after loading the xml?

djr33
06-22-2010, 12:12 AM
Loop through the data.
As has been said before, this would all be easier using a database. It's possible in XML, but little problems like this are going to be a lot more difficult to handle.