with Ada.Text_IO; use Ada.Text_IO;

-- from XmlAda
with Input_Sources.File;
with Sax.Readers;

-- from AdaDoc
with Module_Interface;
with Module;
with Module.Latex;
with Module.HTML;

procedure Test_Module is

   procedure Parse_XML ( XML_Name : String;
                         Module_Instance : Module.Object_Access;
                         Module_Option : String) is

      XML_File : Input_Sources.File.File_Input;
      Reader  : Module_Interface.Object;
   begin
      Module_Interface.Fixe_Module(Reader, Module_Instance , Module_Option);

      Input_Sources.File.Set_Public_Id(XML_File, XML_Name);
      Input_Sources.File.Set_System_Id(XML_File, XML_Name);
      Input_Sources.File.Open(XML_Name, XML_File);

      Module_Interface.Parse(Reader, XML_File);

      Input_Sources.File.Close(XML_File);
   end Parse_XML;




   Modules : array (Positive range <>) of Module.Object_Access := (
                                                         new Module.Latex.Object,
                                                         new Module.HTML.Object
                                                         );

   Type String_Access is access string;
   Files : array (Positive range <>) of String_Access := (
                                                          new String'("Complet.xml"),
                                                          new String'("record.xml"),
                                                          new String'("Module.xml"),
                                                          new String'("Dict_TDA.xml"),
                                                          new String'("Stack_ASM.xml"),
                                                          new String'("Module.HTML.xml"),
                                                          new String'("tout.xml"),
                                                          new String'("xmltest.xml")
                                                          );
begin
   for I in Files'Range loop
      Put_Line(Files(I).all);
      for J in Modules'Range loop

         Parse_XML(Files(I).all,Modules(J), "");
      end loop;
      New_Line;
   end loop;
end Test_Module;
