|
Boost Users : |
From: Tan, Tom (Shanghai) (TTan_at_[hidden])
Date: 2008-03-03 04:37:37
I am trying 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.
Can anyone help to clarify?
Thanks,
tom
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net