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






Attachment: main_test.cc
Description: Binary data



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