2017-01-07 7 views
0

私はBoost 1.62.0を使用していて、the ISO standardによれば、さまざまなXMLファイルが含まれているExcel .xlsxファイルを解析しようとしています。 [Content_Types] .xmlファイルが正常に読み込まれます。しかし、私はそれがこのように例外をスロー読みしようとしている(workbook.xml)ファイル(workbook.xml.rels)第二と第三のために:ここでなぜboost :: property_tree :: read_xmlが有効なOffice Open XMLを読み込むのですか?

/usr/local/include/boost/property_tree/detail/xml_parser_read_rapidxml.hpp(138): Throw in function void boost::property_tree::xml_parser::read_xml_internal(std::basic_istream<typename Ptree::key_type::value_type> &, Ptree &, int, const std::string &) [Ptree = boost::property_tree::basic_ptree<std::__1::basic_string<char>, std::__1::basic_string<char>, std::__1::less<std::__1::basic_string<char> > >] 
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::property_tree::xml_parser::xml_parser_error> > 
std::exception::what: ../tmp/UX0s9R9kBpSxFB40s9OTzTD9/xl/_rels/workbook.xml.rels(1): expected < 

/XL/_rels /ワークブックです。 xml.rels(デフォルトでは縮小されます):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet8.xml"/><Relationship Id="rId13" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet13.xml"/><Relationship Id="rId18" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet3.xml"/><Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet7.xml"/><Relationship Id="rId12" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet12.xml"/><Relationship Id="rId17" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet17.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet2.xml"/><Relationship Id="rId16" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet16.xml"/><Relationship Id="rId20" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet6.xml"/><Relationship Id="rId11" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet11.xml"/><Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet5.xml"/><Relationship Id="rId15" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet15.xml"/><Relationship Id="rId10" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet10.xml"/><Relationship Id="rId19" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet4.xml"/><Relationship Id="rId9" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet9.xml"/><Relationship Id="rId14" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet14.xml"/></Relationships> 

そして/xl/workbook.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="5" lowestEdited="5" rupBuild="9302"/><workbookPr defaultThemeVersion="124226"/><bookViews><workbookView xWindow="360" yWindow="420" windowWidth="24675" windowHeight="11805" firstSheet="3" activeTab="16"/></bookViews><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/><sheet name="Sheet2" sheetId="2" r:id="rId2"/><sheet name="Sheet3" sheetId="3" r:id="rId3"/><sheet name="Sheet4" sheetId="4" r:id="rId4"/><sheet name="Sheet5" sheetId="5" r:id="rId5"/><sheet name="Sheet6" sheetId="6" r:id="rId6"/><sheet name="Sheet7" sheetId="7" r:id="rId7"/><sheet name="Sheet8" sheetId="8" r:id="rId8"/><sheet name="Sheet9" sheetId="9" r:id="rId9"/><sheet name="Sheet10" sheetId="10" r:id="rId10"/><sheet name="Sheet11" sheetId="11" r:id="rId11"/><sheet name="Sheet12" sheetId="12" r:id="rId12"/><sheet name="Sheet13" sheetId="13" r:id="rId13"/><sheet name="Sheet14" sheetId="14" r:id="rId14"/><sheet name="Sheet15" sheetId="15" r:id="rId15"/><sheet name="Sheet16" sheetId="16" r:id="rId16"/><sheet name="Sheet17" sheetId="17" r:id="rId17"/></sheets><calcPr calcId="144525"/></workbook> 

私はすでに様々なオンラインXMLのバリデータを使用してXMLを検証してきたし、それはそれらのすべてに合格しました。 boost :: property_tree :: read_xmlが最初の行に '<'を入れるのはなぜですか?

答えて

0

OK、私はboost documentationから答えを見つけました:

は残念ながら、これを書いている時点でのブーストにはXMLパーサはありません。したがって、ライブラリには、XMLパースサポートを提供するためのRapidXMLパーサー(現在はバージョン1.13)が含まれています。 RapidXMLはXML標準を完全にサポートしていません。それはDTDを解析することができず、したがって完全なエンティティ置換を行うことができない。

他のXMLパーサーを使用する必要があるようです。

関連する問題