[Expat-bugs] [ expat-Bugs-653180 ] problem with column and line numbers

noreply at sourceforge.net noreply at sourceforge.net
Fri Dec 13 18:18:50 EST 2002


Bugs item #653180, was opened at 2002-12-13 05:01
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=653180&group_id=10127

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: MM Zeeman (mmzeeman)
>Assigned to: Karl Waclawek (kwaclaw)
Summary: problem with column and line numbers 

Initial Comment:

XML_GetCurrentColumnNumber returns 2 times the  actual
column 
number. The same holds for XML_GetCurrentLineNumber. The 
XML_GetCurrentByteIndex function returns the correct
value. 

The expat version i'm using is: expat_1.95.5



----------------------------------------------------------------------

>Comment By: Karl Waclawek (kwaclaw)
Date: 2002-12-13 21:18

Message:
Logged In: YES 
user_id=290026

Does this also happen in other situations?
For instance:
- inside a handler
- when XML_Parse returns with an error?

----------------------------------------------------------------------

Comment By: MM Zeeman (mmzeeman)
Date: 2002-12-13 06:01

Message:
Logged In: YES 
user_id=350634

I forgot to add the tests:

START_TEST(test_line_number_maas)
{  
  char *text = "<tag>\n"
               "\n"
               "\n</tag>";
  int lineno;
  if (XML_Parse(parser, text, strlen(text), 0) ==
XML_STATUS_ERROR)
      xml_failure(parser);
  lineno = XML_GetCurrentLineNumber(parser);
  if (lineno != 4) {
      char buffer[100];
      sprintf(buffer, "expected 4 lines, saw %d", lineno);
      fail(buffer);
  }
}
END_TEST

START_TEST(test_column_number_maas)
{
  char *text = "<tag></tag>";
  int colno;
  if (XML_Parse(parser, text, strlen(text), 0) ==
XML_STATUS_ERROR)
            xml_failure(parser);
  colno = XML_GetCurrentColumnNumber(parser);
  if (colno != 11) {
      char buffer[100];
      sprintf(buffer, "expected 11 columns, saw %d", colno);
      fail(buffer);
  }
}
END_TEST

Added to the test suite this resulted in:

Running suite(s): basic
93%: Checks: 31, Failures: 2, Errors: 0
tests/runtests.c:342:F:basic tests: expected 4 lines, saw 7
tests/runtests.c:357:F:basic tests: expected 11 columns, saw 22

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=653180&group_id=10127



More information about the Expat-bugs mailing list