title: xml parsing using boost
body: <p>I am parsing below xml file using BOOST library-    </p>
  
  <pre><code>&lt;da&gt;
          &lt;m_day Type="int"&gt;15&lt;/m_day&gt;
          &lt;m_month Type="int"&gt;8&lt;/m_month&gt;
          &lt;m_year Type="int"&gt;1947&lt;/m_year&gt;
  &lt;/da&gt;
  </code></pre>
  
  <p>My cpp code is :</p>
  
  <pre><code>    #include &lt;boost/archive/xml_oarchive.hpp&gt; 
      #include &lt;boost/archive/xml_iarchive.hpp&gt;
      #include &lt;iostream&gt; 
      #include &lt;fstream&gt; 
  
      typedef struct date { 
          unsigned int m_day;
          unsigned int m_month;
          unsigned int m_year;
          date( int d,  int m,  int y) : m_day(d), m_month(m), m_year(y) 
          {}
          date() : m_day(1), m_month(1), m_year(2000) 
          {}
          friend std::ostream&amp; operator &lt;&lt; (std::ostream&amp; out, date&amp; d) 
          {
              out &lt;&lt; "day: " &lt;&lt; d.m_day 
                    &lt;&lt; " month: " &lt;&lt; d.m_month
          &lt;&lt; " year: " &lt;&lt; d.m_year;
              return out;
          }
          template&lt;class Archive&gt;
          void serialize(Archive&amp; archive, const unsigned int version)
          {
          archive &amp; BOOST_SERIALIZATION_NVP(m_day);
              archive &amp; BOOST_SERIALIZATION_NVP(m_month);
              archive &amp; BOOST_SERIALIZATION_NVP(m_year);
          }
      } date;
  
      BOOST_CLASS_IMPLEMENTATION(date, boost::serialization::object_serializable);//object_serializable);
  
      unsigned int flags =   boost::archive::no_header;
  
  
      int main()
      {
  
       std::ifstream file1("archive.xml");
       boost::archive::xml_iarchive ia(file1,flags);
       date dr;
       ia &gt;&gt; BOOST_SERIALIZATION_NVP(dr);
  
  
       std::ofstream file("archive2.xml");
        boost::archive::xml_oarchive oa(file,flags);
      //  date da(15, 8, 1947);
        oa &amp; BOOST_SERIALIZATION_NVP(dr);
  
  
      return 0;
      }
  </code></pre>
  
  <p>I am getting below error :</p>
  
  <p>terminate called after throwing an instance of 'boost::archive::archive_exception'
  what():  input stream error
  Aborted (core dumped)</p>
  
  <p>for Normal xml without attributes(as mentioned below) the above code is working fine</p>
  
  <pre><code>&lt;da&gt;
          &lt;m_day&gt;15&lt;/m_day&gt;
          &lt;m_month&gt;8&lt;/m_month&gt;
          &lt;m_year&gt;1947&lt;/m_year&gt;
  &lt;/da&gt;
  </code></pre>
  
  <p>But for previous xml file ,Is there any problem in code ? could you please let me know if it is possible with boost.i have searched so much to find the answer but failed to get any.
  Thanks in Advance !!!</p>