diff --git a/parser.c b/parser.c index bfe96fd3..9e58379a 100644 --- a/parser.c +++ b/parser.c @@ -7365,10 +7365,9 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { if (ent == NULL) { /* * Create a reference for undeclared entities. - * TODO: Should we really create a reference if entity - * substitution is enabled? */ - if ((ctxt->sax != NULL) && + if ((ctxt->replaceEntities == 0) && + (ctxt->sax != NULL) && (ctxt->disableSAX == 0) && (ctxt->sax->reference != NULL)) { ctxt->sax->reference(ctxt->userData, name); diff --git a/result/noent/undeclared-entity.xml b/result/noent/undeclared-entity.xml index 1fd092f7..3db97bc1 100644 --- a/result/noent/undeclared-entity.xml +++ b/result/noent/undeclared-entity.xml @@ -3,5 +3,5 @@ - &undeclared; + diff --git a/result/noent/undeclared-entity.xml.sax2 b/result/noent/undeclared-entity.xml.sax2 index 56f3f3d9..60eaaea2 100644 --- a/result/noent/undeclared-entity.xml.sax2 +++ b/result/noent/undeclared-entity.xml.sax2 @@ -16,7 +16,6 @@ SAX.characters( SAX.startElementNs(elem, NULL, NULL, 0, 0, 0) SAX.getEntity(undeclared) SAX.warning: Entity 'undeclared' not defined -SAX.reference(undeclared) SAX.endElementNs(elem, NULL, NULL) SAX.characters( , 1) diff --git a/result/undeclared-entity.xml.rde b/result/undeclared-entity.xml.rde index 29ebf622..065f91be 100644 --- a/result/undeclared-entity.xml.rde +++ b/result/undeclared-entity.xml.rde @@ -7,7 +7,6 @@ 1 14 #text 0 1 1 1 elem 0 0 -2 5 undeclared 0 0 1 15 elem 0 0 1 14 #text 0 1