Wednesday, 30 December 2015

XML : Reading contents of XML file in C++ without having to remove the XML declaration [duplicate]

This question already has an answer here:

I want to read an XML file, but I can't read it because of the XML declaration. If I remove the declaration - it has no problem.

That's my XML file:

  <?xml version="1.0" encoding="utf-16"?>  <MovieMain MovieName="M1" Version="1.29746.011215">    <FrameGroups FirstFrame="START" LastFrame="END">      <GroupFramesDescription>ALL MOVIE</GroupFramesDescription>      <frames Framenumber="1" SkipFrame="null">        <ObjectsGroup Name="2_Color">          <LeftUpCorner X="34" Y="93" Z="0" />          <RightDownCorner X="102" Y="147" Z="0" />          <InfoAtt AttName="INDEX" AttInfo="2" />          <InfoAtt AttName="Category" AttInfo="chair" Probability="0.1" />            </ObjectsGroup>        <ObjectsGroup Name="5_Color">          <LeftUpCorner X="187" Y="29" Z="0" />          <RightDownCorner X="250" Y="116" Z="0" />          <InfoAtt AttName="INDEX" AttInfo="5" />          <InfoAtt AttName="Category" AttInfo="computer bag" Probability="0.95" />               </ObjectsGroup>      </frames>    </FrameGroups>  </MovieMain>    

I read the file with the QT readNextStartElement() function. and when I leave the XML declaration it returns an empty pointer.

No comments:

Post a Comment