sax and special entities

J

john bailo

A javabean that uses sax is having trouble importing
an xml file that has   in the fields.

Is there anyway to configure sax to interpret this as a
special entity reference?
 
M

Mike Brown

A javabean that uses sax is having trouble importing
an xml file that has   in the fields.

Nothing wrong with your parser... the XML that contains a reference to an
entity other than one of the predefined ones (amp, lt, gt, quot, apos) must
reference a DTD containing a declaration of that entity. (DTDs are checked
for entity declarations and attribute value defaults even if the parser is
not validating.)

First ensure that the nbsp entity is declared. For example, this will always
work:

<!DOCTYPE foo [ <!ENTITY nbsp " "> ]>

....and this will work if your XML parser is configured to read external DTDs
(they have the option not to read any external files at all):

<!DOCTYPE foo SYSTEM "xhtml-lat1.ent">

If you go with the latter example, get xhtml-lat1.ent from
http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent and put it in the same
directory as the XML; don't refer to the w3.org copy directly. See the XHTML
spec for references to the other .ent files for all the HTML/XHTML entities.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top