[xml] Reusing xmlTextReader and BOM

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
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!


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