Re: [xml] Line numbers stored by libxml2

On Thu, Oct 11, 2007 at 07:53:08PM +0200, Mike Hommey wrote:
On Wed, Oct 10, 2007 at 11:33:00AM +0200, Mike Hommey wrote:
On Wed, Oct 10, 2007 at 04:57:46AM -0400, Daniel Veillard <veillard redhat com> wrote:
On Tue, Oct 09, 2007 at 07:43:36PM +0200, Mike Hommey wrote:

I got a report against the debian package containing xmllint [1] about
the fact that lines above 65535 are incorrectly reported as line 65535,
at least in schema validation reports.

The problem here is that the xmlNode struct only stores the line number
as an unsigned short, which explains the saturation at 65535. Now,
changing this the basic way will obviously break ABI, so I'm wondering
- you consider this bug a bug, or don't care about xml files with more
than 65535 lines,

  I consider that no normal user is gonna use an editor to edit a file at line
100,000 . Such a file is gonna be machine generated. The fix will be to fix the
generator, and the likelyhood of having the same error occur before 65,535 is
high enough that they can get the context from another occurence very probably.
  Also if using such document you usually use streaming interfaces, so the
parsing context is available and ctxt->input->line is a 32 bit int which can
be looked at to check if needed and complement the missing bit without
changing the APIs or ABIs

The only problem is that it seems that schema error handling doesn't report
line numbers when using the stream API (xmllint --stream --schema).

I took a quick look at what happens, and there is no parser context
available in the xmlSchemaValidCtxt, so there is sadly no way to get the
line number from there. The strange thing it that there are various
context pointers in the structure, but all are always NULL in all my
tries with various parameters.

  Well, maybe the contexts could be extended when registering to the
streamer to provide the informations, it's a bit of hacking but could
be protected within the xmlreader.c internals.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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