-- $Date: 2004/02/25 07:12:35 $
-- $Revision: 1.8 $
-- $Author: jcrocholl $

with Integer_Strings; use Integer_Strings;

package body Times.MusicXML is

   -- Read time data from an XML reader.
   function Read_Beats
     (XML    : access XML_Reader-- Use this XML reader.
      Symbol : in Symbol_Enum)    -- The initial symbol.
     return Time_Access           -- The newly created time.
   is
      Beats     : Positive;
      Beat_Type : Positive;
   begin
      -- Assert_Tag(XML, "beats");
      Beats := To_Number(Read_Data(XML));
      Exit_Element(XML);

      Assert_Tag(XML, "beat-type");
      Beat_Type := To_Number(Read_Data(XML));
      Exit_Element(XML);

      return Create(Symbol, Beats, Beat_Type, False);
   end Read_Beats;

   -- Write time data to an XML writer.
   procedure Write_Beats
     (XML  : access XML_Writer-- Use this XML writer.
      This : access Time)       -- Write this time.
   is
   begin
      -- Start_Element(XML, "time");
      Write_Element(XML, "beats", To_String(Get_Beats(This)));
      Write_Element(XML, "beat-type", To_String(Get_Beat_Type(This)));
      -- Close_Element(XML, "time");
   end Write_Beats;

end Times.MusicXML;