[xml] Trouble with encodings and "push" parsing



Hello.

I am the developer of "doxymacs" (http://doxymacs.sourceforge.net/) and
I use libxml2 to parse the XML tags file that doxygen produces
(http://www.doxygen.org/).  Recently, doxygen has added the following
line to the top of each XML tags file:

<?xml version='1.0' encoding='ISO-8859-1' standalone='yes'?>

The "encoding..." bit causes my parser to break in ways I don't fully
understand.

For example, if one takes the XML file here:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/doxymacs/doxymacs/example/doc/doxy.tag?rev=1.6&content-type=text/vnd.viewcvs-markup


and feeds it to "xmllint --push - < doxy.tag", everything is fine:

[doc]$ xmllint --push - < doxy.tag
<output snipped>
[doc]$ echo $?
0

So xmllint is happy.  However, if I run it through the parser I have
written (source available at
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/doxymacs/doxymacs/c/), I
get:

[c]$ ./doxymacs_parser < ../example/doc/doxy.tag
stdin:3: error: Specification mandate value for attribute kin
compound
                                            ^
stdin:3: error: Specification mandate value for attribute mandate
compound
                                                                                                 ^
                                                                                                 
... and a whole pile of other errors that don't make any sense to me.


If you note, my main() function looks almost exactly like the (important
bits) of parseAndPrintFile(char *) from xmllint.c, and yet the call to
xmlParseChunk at line 539 of doxymacs_parser.c returns "1", indicating
failure.

If I remove the "encoding" bit from the doxy.tags file, it all works
fine.

If I change the number of chars that I initially read in at line 517 of
doxymacs_parser.c then I get different errors (which is really strange).

So, I'm at a bit of a loss as to what's happening or how I can fix it.
Any comments about how I'm using libxml in my code would be appreciated
as well.

I am using libxml2 version 2.1.12

If you could, please cc: me on replies.


-- 
Ryan T. Sammartino
http://members.shaw.ca/ryants/
The trouble with telling a good story is that it invariably reminds
the other fellow of a dull one.
                -- Sid Caesar



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