1------------------------------------------------------------------------------
2--                                                                          --
3--                            Matreshka Project                             --
4--                                                                          --
5--                               XML Processor                              --
6--                                                                          --
7--                        Runtime Library Component                         --
8--                                                                          --
9------------------------------------------------------------------------------
10--                                                                          --
11-- Copyright © 2013-2014, Vadim Godunko <vgodunko@gmail.com>                --
12-- All rights reserved.                                                     --
13--                                                                          --
14-- Redistribution and use in source and binary forms, with or without       --
15-- modification, are permitted provided that the following conditions       --
16-- are met:                                                                 --
17--                                                                          --
18--  * Redistributions of source code must retain the above copyright        --
19--    notice, this list of conditions and the following disclaimer.         --
20--                                                                          --
21--  * Redistributions in binary form must reproduce the above copyright     --
22--    notice, this list of conditions and the following disclaimer in the   --
23--    documentation and/or other materials provided with the distribution.  --
24--                                                                          --
25--  * Neither the name of the Vadim Godunko, IE nor the names of its        --
26--    contributors may be used to endorse or promote products derived from  --
27--    this software without specific prior written permission.              --
28--                                                                          --
29-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS      --
30-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT        --
31-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR    --
32-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT     --
33-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   --
34-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
35-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR   --
36-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF   --
37-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING     --
38-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS       --
39-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.             --
40--                                                                          --
41------------------------------------------------------------------------------
42--  $Revision: 4960 $ $Date: 2014-10-25 14:47:11 +0400 (Sat, 25 Oct 2014) $
43------------------------------------------------------------------------------
44with Ada.Containers.Vectors;
45
46with League.Strings;
47with XML.SAX.Attributes;
48
49package XML.Templates.Streams is
50
51   pragma Preelaborate;
52
53   type XML_Stream_Element_Kinds is
54    (Empty,
55     Text,
56     Start_Element,
57     End_Element,
58     Start_Prefix_Mapping,
59     End_Prefix_Mapping,
60     Processing_Instruction,
61     Comment,
62     Start_CDATA,
63     End_CDATA,
64     Start_DTD,
65     End_DTD);
66
67   type XML_Stream_Element (Kind : XML_Stream_Element_Kinds := Empty) is record
68      case Kind is
69         when Text | Comment =>
70            Text : League.Strings.Universal_String;
71
72         when Start_Element | End_Element =>
73            Namespace_URI  : League.Strings.Universal_String;
74            Local_Name     : League.Strings.Universal_String;
75            Qualified_Name : League.Strings.Universal_String;
76
77            case Kind is
78               when Start_Element =>
79                  Attributes : XML.SAX.Attributes.SAX_Attributes;
80
81               when others =>
82                  null;
83            end case;
84
85         when Start_Prefix_Mapping | End_Prefix_Mapping =>
86            Prefix : League.Strings.Universal_String;
87
88            case Kind is
89               when Start_Prefix_Mapping =>
90                  Mapped_Namespace_URI : League.Strings.Universal_String;
91
92               when others =>
93                  null;
94            end case;
95
96         when Processing_Instruction =>
97            Target : League.Strings.Universal_String;
98            Data   : League.Strings.Universal_String;
99
100         when Start_DTD =>
101            Name      : League.Strings.Universal_String;
102            Public_Id : League.Strings.Universal_String;
103            System_Id : League.Strings.Universal_String;
104
105         when End_DTD | Start_CDATA | End_CDATA | Empty =>
106            null;
107      end case;
108   end record;
109
110   package XML_Stream_Element_Vectors is
111     new Ada.Containers.Vectors (Positive, XML_Stream_Element);
112
113end XML.Templates.Streams;
114