Hosted by
|
with Readers; use Readers;
with Token_Readers; use Token_Readers;
package body Encodings.MusicXML is
function Read_Encoding
(XML : access XML_Reader)
return Encoding_Access
is
Result : Encoding_Access := Create;
begin
while Descend(XML) loop
Exit_Tag(XML);
if Found(XML, "encoding-date") then
Set_Encoding_Date(Result, Read_Data(XML));
elsif Found(XML, "encoder") then
Set_Encoder(Result, Read_Data(XML));
elsif Found(XML, "software") then
Set_Software(Result, Read_Data(XML));
elsif Found(XML, "encoding-description") then
Set_Encoding_Description(Result, Read_Data(XML));
else
XML_Expect_Error(XML, "/encoding",
"encoding-date" / "encoder" /
"software" / "encoding-description");
end if;
Exit_Element(XML);
end loop;
Exit_Tag(XML);
return Result;
end Read_Encoding;
procedure Write_Encoding
(XML : access XML_Writer;
This : access Encoding)
is
begin
Start_Element(XML, "encoding");
if Get_Software(This) /= "" then
Write_Element(XML, "software", Get_Software(This));
end if;
if Get_Encoding_Date(This) /= "" then
Write_Element(XML, "encoding-date", Get_Encoding_Date(This));
end if;
Close_Element(XML, "encoding");
end Write_Encoding;
end Encodings.MusicXML;
|