From b5a60eccfd6a14ac4dea3f00714bf716b66e4cc6 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Mon, 18 Mar 2002 11:45:56 +0000 Subject: [PATCH] Wilfried Teiken provided a hackish but working way to get context reported * parser.c: Wilfried Teiken provided a hackish but working way to get context reported back on entities when parsing with SAX and without breaking the DOM build. Daniel --- ChangeLog | 6 ++++++ parser.c | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0cabfe6b..02005ae6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Mar 18 12:44:23 CET 2002 Daniel Veillard + + * parser.c: Wilfried Teiken provided a hackish but working + way to get context reported back on entities when parsing + with SAX and without breaking the DOM build. + Sun Mar 17 11:31:55 CET 2002 Daniel Veillard * c14n.c: applied a new patch from Aleksey Sanin diff --git a/parser.c b/parser.c index b8a67f19..97bb233b 100644 --- a/parser.c +++ b/parser.c @@ -5251,17 +5251,29 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { * if its replacement text matches the production labeled * content. */ + + void *user_data; + /* + * This is a bit hackish but this seems the best + * way to make sure both SAX and DOM entity support + * behaves okay. + */ + if (ctxt->userData == ctxt) + user_data = NULL; + else + user_data = ctxt->userData; + if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) { ctxt->depth++; ret = xmlParseBalancedChunkMemory(ctxt->myDoc, - ctxt->sax, NULL, ctxt->depth, + ctxt->sax, user_data, ctxt->depth, value, &list); ctxt->depth--; } else if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) { ctxt->depth++; ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, - ctxt->sax, NULL, ctxt->depth, + ctxt->sax, user_data, ctxt->depth, ent->URI, ent->ExternalID, &list); ctxt->depth--; } else {