Re: [xml] unsinged short for line numbers



On Wed, Feb 14, 2007 at 11:05:27AM +0100, Stefan Froehlich wrote:
On Wed, Feb 14, 2007 at 04:57:02AM -0500, Daniel Veillard wrote:
| 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.

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.

Problem is, I do _not_ get the error at parsing time. The documents are
(mostly) well formed and survive an

| xmlLineNumbersDefault(1);
| doc = xmlParseFile(filename);
| cur = xmlDocGetRootElement(doc);

perfectly. But when I traverse through the tree afterwards, beginning at
"cur" and analyze its data, I normally find some (purely semantic)
errors which I want to present the user with their line numbers
nevertheless.

Completely out of luck?

  Keep your own counter as you traverse the tree based in the 16bits values.

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]