Re: [xml] column information in the error structure (patch)



Here's the patch I have for the line numbers and columns. Not sure if I caught all the spots, but my line/columns have been more accurate with this at least using SAX.

Rob

Aleksey Sanin wrote:

Thanks!

Aleksey

Rob Richards wrote:

To save you some time, I had gone through parser.c a while back and have a patch for this which I had forgotten about (been sitting in my build for a while). Will submit it once I get back to my desktop.

Rob

Index: parser.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/parser.c,v
retrieving revision 1.406
diff -c -r1.406 parser.c
*** parser.c    25 Dec 2004 10:14:57 -0000      1.406
--- parser.c    4 Jan 2005 11:09:15 -0000
***************
*** 2421,2426 ****
--- 2421,2427 ----
      while (*in != 0 && *in == *cmp) {
        ++in;
        ++cmp;
+       ctxt->input->col++;
      }
      if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) {
        /* success */
***************
*** 3201,3210 ****
  get_more_space:
            while (*in == 0x20) in++;
            if (*in == 0xA) {
!               ctxt->input->line++;
                in++;
                while (*in == 0xA) {
!                   ctxt->input->line++;
                    in++;
                }
                goto get_more_space;
--- 3202,3211 ----
  get_more_space:
            while (*in == 0x20) in++;
            if (*in == 0xA) {
!               ctxt->input->line++; ctxt->input->col = 1;
                in++;
                while (*in == 0xA) {
!                   ctxt->input->line++; ctxt->input->col = 1;
                    in++;
                }
                goto get_more_space;
***************
*** 3237,3249 ****
                   ((*in > '&') && (*in < '<')) ||
                   ((*in > '<') && (*in < ']')) ||
                   ((*in >= 0x20) && (*in < '&')) ||
!                  (*in == 0x09))
!               in++;
            if (*in == 0xA) {
!               ctxt->input->line++;
                in++;
                while (*in == 0xA) {
!                   ctxt->input->line++;
                    in++;
                }
                goto get_more;
--- 3238,3252 ----
                   ((*in > '&') && (*in < '<')) ||
                   ((*in > '<') && (*in < ']')) ||
                   ((*in >= 0x20) && (*in < '&')) ||
!                  (*in == 0x09)) {
!                       in++;
!                       ctxt->input->col++;
!               }
            if (*in == 0xA) {
!               ctxt->input->line++; ctxt->input->col = 1;
                in++;
                while (*in == 0xA) {
!                   ctxt->input->line++; ctxt->input->col = 1;
                    in++;
                }
                goto get_more;
***************
*** 3255,3260 ****
--- 3258,3264 ----
                    return;
                }
                in++;
+               ctxt->input->col++;
                goto get_more;
            }
            nbchar = in - ctxt->input->cur;
***************
*** 3288,3294 ****
                if (*in == 0xA) {
                    ctxt->input->cur = in;
                    in++;
!                   ctxt->input->line++;
                    continue; /* while */
                }
                in--;
--- 3292,3298 ----
                if (*in == 0xA) {
                    ctxt->input->cur = in;
                    in++;
!                   ctxt->input->line++; ctxt->input->col = 1;
                    continue; /* while */
                }
                in--;


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