[xml] xmlCreatePushParserCtxt() docs wrong (was RE: [libxml++] sax_pars er example: entity not defined)



Daniel, as part of the story below, I noticed that the documentation
for xmlCreatePushParserCtxt() is wrong:
http://xmlsoft.org/html/libxml-parser.html#xmlCreatePushParserCtxt

The user_data parameter is not returned to SAX callbacks (The context is, as
void*). 
That parameter should probably always be 0.

Murray Cumming
www.murrayc.com
murrayc usa net

-----Original Message-----
From: libxmlplusplus-general-admin lists sourceforge net 
[mailto:libxmlplusplus-general-admin lists sourceforge net] 
On Behalf Of Murray Cumming Comneon com
Sent: Dienstag, 25. November 2003 20:32
To: libxmlplusplus-general lists sourceforge net
Subject: RE: [libxml++] sax_parser example: entity not defined


Again, there is nothing wrong with what your new stuff does.
I think it's wonderful. I just want to solve this little 
question. I need to do the tests.

OK. I have tracked the problem down. We get an "entity is 
undeclared" error because we put our Parser* in 
_xmlParserCtxt::userData. In my simplified test code, we also 
get the error if we set it to 0. If we leave it alone then we 
don't get the error. See my attached test code.

This suggests a libxml API and documentation bug that Daniel 
preferred not to fix fully: 
http://mail.gnome.org/archives/xml/2002-> April/msg00193.html


Here is the latest documentation: 
http://www.xmlsoft.org/html/libxml-parser.html#commentSAXFunc
which, now that we know about the problem, probably means 
that we should not set userData. It seems that userData is 
not user data as we understand it. We get the context instead 
of the userData in the callback. 

But we can get the instance from the private member of the 
context, so everything will be OK. It works. I'll check it 
all in tomorrow.

Murray Cumming
www.murrayc.com
murrayc usa net










[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]