An & in an attribute reference causes an "Invalid
entity reference found" error. There was notes about
this problem in Google groups:
http://groups.google.com/groups?q=%
22invalid+entity+reference+found&hl=en&lr=&ie=UTF-
8&selm=3f66e42d%241%
40newsgroups.borland.com&rnum=1
Logged In: YES
user_id=290026
It seems we never got notified of this bug entry.
This bug occurs because TSAXDelphiReader.DoElement() (or rather, the StartElement;() sub procedure within it) processes each "entity" twice.
The comments suggest the first pass is to "Handle namespace declarations separately", while the second pass is to "Now process the names"
The result is that in the first pass, the ampersand escape sequence is correctly translated into a literal ampersand.
In the second pass, that naked ampersand causes an "Invalid entity reference found" exception, which is not recoverable.
My workaround:
line 313 of saxkw.pas, comment out the *second* call to ReplaceEntiries():
//Attribs.Values[AttrName] := ReplaceEntities(Attribs.Values[AttrName]);
(not sure if there are any consequences...)
BTW, I contacted the original developer with this info and the response was:
> Sorry I can't help you out. I haven't looked at this code for over 8 years.