Bug 6111 - Improper entity callbacks for entities in attrib values
Summary: Improper entity callbacks for entities in attrib values
Status: NEW
Alias: None
Product: Xerces-J
Classification: Unclassified
Component: SAX (show other bugs)
Version: 1.4.4
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: Xerces-J Developers Mailing List
Depends on:
Reported: 2002-01-29 19:43 UTC by Jason Hunter
Modified: 2004-11-16 19:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Jason Hunter 2002-01-29 19:43:14 UTC
It seems with Xerces 1.3.x and 1.4.x that if you turn entity expansion off 
(http://xml.org/sax/features/external-general-entities), there's some odd 
behavior with entities in attribute values.

Per my reading of SAX, entities in attribute values should still be silently 
expanded, and in fact Xerces does expand them.  It just doesn't do so 
silently.  Instead Xerces generates startEntity/endEntity events for the 
entities that were expanded in the attribute values.  The events occur before 
the startElement of the element containing the attribute.  You don't get the 
entity events if entity expansion is on.

Crimson behaves as expected and when silently expanding entities in attribute 
values it truly does it silently.

This is affecting JDOM where using SAXBuilder to build from:

<?xml version="1.0" ?>
<!DOCTYPE internalentities [
        <!ELEMENT internalentites (#PCDATA)>
        <!ENTITY simple 'simple entity' >
        <subelement test2="&simple;" />

Works perfectly in Crimson but with Xerces results in:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE internalentities [
  <!ELEMENT internalentites (#PCDATA)>
  <!ENTITY simple "simple entity">
        &simple;<subelement test2="simple entity" />

Because of the spurious startEntity/endEntity callbacks.