GNOME Bugzilla – Bug 424017
Don't cut errors at 80 characters (or give the column position of the error)
Last modified: 2007-04-04 04:33:36 UTC
libxml2 (and a lot of tools based on it) are handicapped by this part of error.c /* search backwards for beginning-of-line maximum 80 characters */ as a result, the exact context of the error is hard to find. e.g in :294: parser error : EntityRef: expecting ';' title="http://www.nytimes.com/2007/03/28/arts/music/28band.html?ex=1332734400&en ^ there is no way to know exactly where in line 294 the error was pointed. The behavior assumes that the application is running in a 80-characters terminal, which seems rather silly, and given the widespread usage of libxml, wrong. Suggested fixes: * an option to output the column number along with the line number (I don't think libxml2 has that, at least the perl binding XML::LibXML doesn't) * or do NOT cut at 80 characters (or only if an environment variable shows there is a 80 chars term... ) Thanks, keep up the good work. Other information:
(In reply to comment #0) > The behavior assumes that the application is running in a 80-characters > terminal, which seems rather silly, and given the widespread usage of libxml, > wrong. This was a very bad way to word this, my apologies. The point I was trying to make is, it's probably not the work of a library to worry about formatting of output. It should, rather, be the work of applications using the lib to trim the output depending on the type of device/UI used.
Then use the structured error handler, you will get the same set of input data as the default handler and do things the way you like them. Suggested readings are: http://xmlsoft.org/html/libxml-xmlerror.html#xmlSetStructuredErrorFunc http://xmlsoft.org/html/libxml-xmlerror.html#xmlError xmlReportError() in error.c since you already started looking there IMHO the API allows to do what you want already, Daniel
Daniel, (In reply to comment #2) > Then use the structured error handler, you will get the same set of > input data as the default handler and do things the way you like them. > Suggested readings are: > http://xmlsoft.org/html/libxml-xmlerror.html#xmlSetStructuredErrorFunc > http://xmlsoft.org/html/libxml-xmlerror.html#xmlError > xmlReportError() in error.c since you already started looking there Thanks for the pointers, you're right, the API allows for more flexible error reporting than I first thought. I'll take the suggestion to the XML::LibXML perl folks. Merci.