Re: [xml] Reusing xmlTextReader and BOM



Hi again!

Does no one have an idea? I'm now always creating/destroying a xmlReader
for every file that I parse. The thing is that I have to parse many
small files after each other, so I think it would really make a
difference if I could reuse the xmlReader.

Any hints are still highly appreciated!
Conny


On Thu, 2009-06-25 at 13:23 +0200, Cornelius Hald wrote:
Hello Everyone!

I'm having trouble reusing a xmlTextReader for parsing several files. 

The problem seems to be connected only with files that start with the
uft-8 BOM.

If I create a new reader for every file like this:
reader = xmlReaderForFile(filename, NULL, 0);
Then everything works as expected. No problems whether or not the files
start with a BOM.

But if I first create a reader like above and then for every other file
do:
xmlReaderNewFile(reader, filename, NULL, 0);
I get problems with files that start with a BOM. Files without BOM still
work fine. The error message is the following:

/home/user/file.xml:1: parser error : Document is empty
ï<?xml version="1.0" encoding="utf-8"?>
^

I'm using libxml 2.6.27 and all my files are encoded as utf-8.

Am I doing something wrong? Is this a known issue? It would be great if
someone could help me!

Thanks!
Conny


_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




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