Changes between Initial Version and Version 1 of XML/Templates


Ignore:
Timestamp:
Nov 2, 2013, 5:45:18 PM (8 years ago)
Author:
vadim.godunko
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • XML/Templates

    v1 v1  
     1[[PageOutline]]
     2
     3= Markup Templates Engine =
     4
     5Markup Templates Engine reads XML template documents and generates XML or HTML5/XHTML5 documents.
     6
     7== Generating of HTML5 Documents ==
     8
     9HTML5 Writer can be used to produce optimized HTML5 documents by using most compact syntax form for attribute values and omitting optional tags.
     10
     11Below is an example of its use with XML Simple Reader (it can obtain stream of SAX events from other sources too, for instance from templates processor):
     12
     13{{{
     14with Ada.Text_IO;
     15
     16with League.Strings;
     17with XML.SAX.Input_Sources.Streams.Files;
     18with XML.SAX.Output_Destinations.Strings;
     19with XML.SAX.Simple_Readers;
     20with XML.SAX.HTML5_Writers;
     21
     22procedure Main is
     23   Input  : aliased XML.SAX.Input_Sources.Streams.Files.File_Input_Source;
     24   Reader : aliased XML.SAX.Simple_Readers.SAX_Simple_Reader;
     25   Writer : aliased XML.SAX.HTML5_Writers.HTML5_Writer;
     26   Output : aliased XML.SAX.Output_Destinations.Strings.SAX_String_Output_Destination;
     27
     28begin
     29   Input.Open_By_File_Name
     30    (League.Strings.To_Universal_String ("page.tmpl"));
     31
     32   --  Configure reader.
     33
     34   Reader.Set_Input_Source (Input'Unchecked_Access);
     35   Reader.Set_Content_Handler (Writer'Unchecked_Access);
     36   Reader.Set_Lexical_Handler (Writer'Unchecked_Access);
     37
     38   --  Configure XML writer.
     39
     40   Writer.Set_Output (Output'Unchecked_Access);
     41
     42   --  Process template.
     43
     44   Reader.Parse;
     45
     46   --  Output result.
     47
     48   Ada.Text_IO.Put (Output.Get_Text.To_UTF_8_String);
     49end Main;
     50}}}