Boost logo

Boost :

From: Tan, Tom (Shanghai) (TTan_at_[hidden])
Date: 2008-03-03 20:25:14


I've posted this message in the user list before with no response. I
realized it might be better to post here again since boost.property_tree
is still in the svn trunk yet to be released with boost 1.5.0.

I am trying to use read_xml() on an xml-format config file, which starts
like this:

<?xml version="1.0" encoding="UTF-16"> .....

This file is well-formed and verified by "XML Copy Writer", it can also
be open by IE or Filefox with no problem.

 I am using this code snippet to parse this file:

 try{

                read_xml<wptree>(xmlfile,pt);

} catch(xml_parser-error e)

{

                e.what();

}

 and it throws an exception saying "expected <".

 By looking into the code I found that, this caused by the fact that
the xmlfile starts with a Unicode Byte Order Mark (BOM)-0xFFFE .

"fffe 3c00 3f00 7800 ......"

However, read_xml() cannot handle this BOM byte and throws. It's easy to
fix it by simply discard the BOM byte, but I wonder whether there is
already a flag to enable/disable this that I am unaware of.

BTW, I am using the svn trunk version.

Can anyone help to clarify?

Thanks,

tom

 


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk