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

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:
> > > > Hi,
> > > > 
> > > > 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
> > > > if
> > > > - 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.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
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]