Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > sax and special entities

Thread Tools

sax and special entities

john bailo
Posts: n/a
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?
Reply With Quote
Mike Brown
Posts: n/a
> 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

<!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 and put it in the same
directory as the XML; don't refer to the copy directly. See the XHTML
spec for references to the other .ent files for all the HTML/XHTML entities.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can you make a SAX-like parser ignore char entities all together... Java 2 02-02-2008 11:19 PM
HTML::Entities::encode() returning wrong(?) entities Jim Higson Perl Misc 3 07-25-2004 09:13 PM
registering entities with sax parser Ralf Schmitt Python 0 06-08-2004 04:55 PM
Re: resolving relative paths for external entities with xml.sax Uche Ogbuji Python 0 08-22-2003 04:07 PM
Re: How to make SAX Parsers aware of entities Usman Syed XML 0 08-13-2003 03:22 PM