Hi,
I'm trying to validate an XML document after parsing it. The DTD is external,
and resides somewhere in the memory (see attached source code).
But when I call xmlIOParseDTD(), I get a segfault. I tracked down the error to
xmlParseElementDecl(), line 4973
NEXT;
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
(ctxt->sax->elementDecl != NULL))
ctxt->sax->elementDecl(ctxt->userData, name, ret,
content);
the reason is that userData is NULL, and elementDecl is a pointer to
xmlSAX2ElementDecl(), which expects a xmlParserCtxtPtr.
Because xmlIOParseDTD creates and handle its own xmlParserCtxt, I'm suspicious
about the line 9954 in parser.c "ctxt->userData = NULL;" and it might have to
be something like "ctxt->userData = ctxt;".
Regards,
Tanguy
Attachment:
main.cpp
Description: Text Data