Re: [xml] unsinged short for line numbers



On Wed, Feb 14, 2007 at 10:34:42AM +0100, Stefan Froehlich wrote:
I develop an application using libxml2 to parse (large) XML files.
To help people locating semantic errors in their input files I
recently added support for printing out line numbers. This seems to
be restricted to the first 65535 lines, however.

What I do have is a node context, and if there is something wrong
with its data content, I call:

| long int *errorLines;
| long int errorCount;
| xmlNodePtr node;
| [...]
| errorLines[errorCount] = xmlGetLineNo(node);

xmlGetLineNo is declared long, which is fine, but it passes back
(struct _xmlNode*)->line, which is unsigned short and the cause of
my trouble.

There was a post on this topic here on July 2nd, 2004, however the
author used a parser context and thus could use an alternative, which
is not available for me.

Since this was almost three years ago, I wonder, if nobody else had
this problem - or is there a simple and obvious way I should go, which
I just don't see?

  For very large document you need access to the parser context to
get the 32bit line number. If the error are issued at parsing time you
do get the parser context as part of the Structured error callback data.

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]