Re: [xml] column information in the error structure



On Mon, Jan 03, 2005 at 11:12:39AM -0800, Aleksey Sanin wrote:
Currently, xmlError structure includes line number but not the column
number. It would be really
nice for me if column number will also be available. However, extending
a public structure is a tricky
business :) And I would like to get everyones opinion before I do a
patch. I can see the following
options:
1) Add one more int field to the end of the xmlError structure.
2) Re-use (with renaming) int1 or int2 fields (someone might use them
already thought).

  usually I do 1) and it works okay *except* when the structure is embedded
as-is in another structure, I made that serious mistake once with xmlValidCtxt
within xmlParserCtxt, and unfortunately I did that again at least in
xmlParserCtxt.

   struct _xmlParserCtxt {
       ....
       xmlError          lastError;
       xmlParserMode     parseMode;    /* the parser mode */
   };

  I'm not sure one can argue that parseMode is only internal data and no
application should use it. So we can't extend xmlError I think :-( and 1)
is kind of out of the possibilities, sorry, I goofed.
  Now about 2) most of the time int2 is not used, actually checking the 
__xmlRaiseError() calls it seems it's never used, or rather 0 is always
passed. So if you want to extend the error messages using int2 sounds fine
for most uses. 
  Of course if it is error you are generating in a higher level you're 
really free to do what you want with those values.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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