libxmlezout-1.06.1.orig/0000755000175000017500000000000011635062102014750 5ustar lbrentalbrentalibxmlezout-1.06.1.orig/GNUmakefile0000644000175000017500000000152011635062074017030 0ustar lbrentalbrentaCPUS := $(shell getconf _NPROCESSORS_ONLN) INSTALL := $(HOME) all:shared_library static_library .PHONY:shared_library static_library shared_library: gnatmake -p -j$(CPUS) -Pbuild_xmlezout_lib.gpr \ -XLIBRARY_KIND=dynamic -XSONAME=libxmlezout.so -XOBJ_DIR=obj-shared static_library: gnatmake -p -j$(CPUS) -Pbuild_xmlezout_lib.gpr \ -XLIBRARY_KIND=static -XOBJ_DIR=obj-static clean: rm -Rf obj-shared obj-static lib rm -f *~ install:all mkdir -p $(INSTALL)/lib/xmlezout mkdir -p $(INSTALL)/include/xmlezout cp -f xmlezout.gpr $(INSTALL)/include/xmlezout.gpr cp -f lib/libxmlezout.a lib/libxmlezout.so $(INSTALL)/lib/xmlezout/ cd $(INSTALL)/lib;ln -s xmlezout/libxmlezout.so;cd - cp -f obj-shared/*.ali $(INSTALL)/lib/xmlezout/ chmod uog-w $(INSTALL)/lib/xmlezout/*.ali cp -f mckae*.ad[sb] $(INSTALL)/include/xmlezout libxmlezout-1.06.1.orig/README0000644000175000017500000001540111635062074015641 0ustar lbrentalbrentaXML EZ_Out Version 1.06 ============ XML EZ_Out is a small set of packages intended to aid the creation of XML-formatted output from within Ada programs. It basically wraps the tags and data provided to it with XML syntax and writes them to a user-supplied medium. This medium can be any sort of writable entity, such as a file, a memory buffer, or even a communications link, such as a socket. The only functionality required of the medium is that it supply a meaningful "Put" (for writing a string) and "New_Line" procedure. Usage ===== IMPORTANT!! XML EZ_Out package instantiations are explicitly designed to be made directly visible with the aid of a "use" clause! Declining to use a "use" will make using EZ_Out inordinately verbose and awkward to use. So use "use", and get a waiver from your programming standard if you have to! The key facilitator of making XML EZ_Out usage readable when generating XML documentation is the overloading of a number of variations of the "=" function. By doing this, a simple XML element having no content, such as: can be generated as: Output_Tag(F, "player", ("lastName" = "Cuddyer", "firstName" = "Michael", "team" = "Twins")); To simplify the specification of the attributes, variations of "=" are provided. Given these declarations: Batting_Average : Float; At_Bats : Natural; One can directly reference the variables: Output_Tag(F, "stats", ("battingAvg" = Batting_Average, "atBats" = At_Bats)); Elements that contain a number of nested sub-elements begin with a Start_Element call and are terminated with an End_Element invocation. Attribute/value pairs can be specified in the Start_Element call, which is then followed by calls to Output_Tag, more Start_Element/End_Element calls, and an Output_Content for any data that makes up the textual body of the element. The only functions that you really need to know to use XML EZ_Out are: Output_XML_Header Output_Processing_Instruction Output_Element Output_Tag Start_Element End_Element Output_Content The "use" of the instantiated package will take of the rest. For an example set of intantiations and usages of the file and buffering capabilities of XML EZ_Out, see the tmeztf.adb program. The generic specification for EZ_Out is: generic type Output_Medium is limited private; with procedure Put(F : in Output_Medium; S : in String) is <>; with procedure New_Line (F : in Output_Medium; Spacing : in Ada.Text_IO.Positive_Count := 1) is <>; -- DEPRECATED -- Control formatting by setting the Current_Format variable in the -- package spec. -- -- Specify whether the XML that is created is to have indenting and -- line breaks. Format : Formatting_Options := Spread_Indented; -- DEPRECATED -- The maximum element nesting depth of an XML document Max_Element_Nesting : Positive := 200; package McKae.XML.EZ_Out.Generic_Medium; Output_Medium is whatever entity is going to received the formatted XML output. As mentioned previously, it can be a file, a stream, a buffer, a socket, whatever. All interaction with it takes place solely through the supplied Put and New_Line procedures, which are obviously modeled after the Ada.Text_IO versions. The Format parameter is now deprecated. Its functionality is now provided by the Current_Format variable in the package specification. The value for the generic Format parameter is now simply used as the inital setting for Current_Format. Format may be removed in some future release. Format, or better yet, its replacement, Current_Format, can be set to either Continuous_Stream or Spread_Indented. Continuous_Stream simply produces a continuous stream of XML content, with no indentation or line breaks. This mode reduces bandwidth and storage requirements, at the cost of not being the easiest to read in its raw form. Spread_Indented provides a more human-readable arrangement of the content. Max_Element_Nesting is used to set the size of an internal stack that keeps track of the start and end tags of the document under construction. Documents probably aren't going to exceed the default 200-level nesting very often, but if that happens, simply increase it. To see the exceptions that can be raised by misusing XML EZ_Out, check the definitions in McKae.XML.EZ_Out. Auxiliary Packages ================== Two auxiliary packages are provided with this distribution: McKae.XML.EZ_Out.Text_File, and McKae.XML.EZ_Out.String_Stream. Text_File is simply an instantiation of the core Generic_Medium package with Ada.Text_IO.File_Type, providing a ready-to-go package for writing XML to ordinary text files. String_Stream uses an in-memory buffer to hold the generated XML text, with a Get_String function for retrieving the entire generated document as a string with one call. Caveats ======= Be aware that XML EZ_Out does no validation of the XML content it is being asked to output, and it is possible to generate malformed documents. That includes the handling of character encoding. While XML_EZ_Out will claim the document is "UTF-8" or otherwise as set by the application, it is up to the application to ensure that correct content is provided in the strings that are passed to its various subprograms. Used appropriately, though, it can provide a clear and readable means to aid the dynamic generation of XML content by Ada programs. Revision History ================ Changes since 1.05: o Fixed bug where calling Output_Content with a negative integer or float argument would drop the leading minus sign o Added ability to completely deallocate memory used by the String_Stream package. [Patch provided by Xavier Grave.] Changes since 1.04: o Deprecated the Format generic parameter, replacing it with a Current_Format variable in the package specification. o Added a package variable Default_Output_Null_Attributes. If True, attributes whose value is an empty string will be output with that empty string as the attribute's value. If False (which is the default), output of the attribute is omitted. [Requested by Niklas Holsti.] Changes since 1.03: o Added quote and apostrophe substitution (""" and '") within attribute values. Changes since 1.02: o Corrected bug in "&" for "&" substition. Changes since 1.01: o Added attribute specification functions ("=") for single character values. Changes since 1.00: o Fixed problem with attributes being given negative numeric values. The minus sign was being dropped. o If an attribute value is an empty string ("") or Null_Unbounded_String, then generation of that attribute specification is skipped. ================== Marc A. Criley McKae Technologies www.mckae.com Last updated: 23 Sep 2006 libxmlezout-1.06.1.orig/build_xmlezout_lib.gpr0000644000175000017500000000154611635062074021374 0ustar lbrentalbrentaproject build_xmlezout_lib is for Library_Name use "xmlezout"; for Library_Kind use External ("LIBRARY_KIND"); for Library_Dir use "lib"; for Library_ALI_Dir use External ("OBJ_DIR") & "/ali"; for Library_Version use External ("SONAME"); for Object_Dir use External ("OBJ_DIR"); for Source_Dirs use ("."); for Excluded_Source_Files use ("tmeztf.adb"); package Compiler is for Default_Switches ("Ada") use ("-gnat05", -- Ada 2005 mode "-gnati1", -- ISO 8859-1 in source code (for generated CORBA stubs) "-gnatf", -- Full compiler error messages "-gnaty", -- Enable style checks "-gnatwa", -- Enable all warnings "-gnatwe"); -- Warning as errors end Compiler; package Binder is for Default_Switches ("Ada") use ("-E"); end Binder; end build_xmlezout_lib; libxmlezout-1.06.1.orig/mckae-xml-ez_out-generic_medium.adb0000644000175000017500000005636211635062074023577 0ustar lbrentalbrenta------------------------------------------------------------------------ -- -- -- McKae Software Utilities -- -- -- -- Copyright (C) 2005-2009 McKae Technologies -- -- -- -- The McKae software utilities are free software; you can -- -- redistribute it and/or modify it under terms of the GNU General -- -- Public License as published by the Free Software Foundation; -- -- either version 2, or (at your option) any later version. McKae -- -- Software Utilities are distributed in the hope that they will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. You should -- -- have received a copy of the GNU General Public License distributed -- -- with DTraq; see file COPYING. If not, write to the Free Software -- -- Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -- -- USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- -- -- The McKae Software Utilities are maintained by McKae Technologies -- -- (http://www.mckae.com). -- ------------------------------------------------------------------------ with Ada.Strings.Fixed; use Ada.Strings.Fixed; package body McKae.XML.EZ_Out.Generic_Medium is ------------------------------------------------------------------------ -- A very basic bounded stack implementation for keeping track of -- nested XML elements. type Stack_Size is new Natural range 0 .. Max_Element_Nesting; subtype Stack_Indices is Stack_Size range 1 .. Stack_Size'Last; type Element_Stacks is array (Stack_Indices) of Unbounded_String; Tag_Stack : Element_Stacks; Top_Of_Stack : Stack_Size := 0; procedure Push (Tag : Unbounded_String); procedure Push (Tag : Unbounded_String) is begin if Top_Of_Stack /= Stack_Size'Last then Top_Of_Stack := Top_Of_Stack + 1; Tag_Stack (Top_Of_Stack) := Tag; else raise Nesting_Too_Deep; end if; end Push; procedure Pop (Tag : out Unbounded_String); procedure Pop (Tag : out Unbounded_String) is begin if Top_Of_Stack /= 0 then Tag := Tag_Stack (Top_Of_Stack); Top_Of_Stack := Top_Of_Stack - 1; else raise Element_Not_Open; end if; end Pop; ------------------------------------------------------------------------ type XML_Component_Kind is (Header_Component, Start_Tag_Component, Content_Component, End_Tag_Component); ------------------------------------------------------------------------ -- Constructed Put_Line from provided primitives procedure Put_Line (F : in Output_Medium; S : in String); procedure Put_Line (F : in Output_Medium; S : in String) is begin Put (F, S); New_Line (F); end Put_Line; ------------------------------------------------------------------------ procedure Replace_Special (C : in String; R : in String; S : in out Unbounded_String); procedure Replace_Special (C : in String; R : in String; S : in out Unbounded_String) is P : Natural := 0; begin if Index (R, C) /= 0 then -- The string to be replaced is present within the replacing -- string (e.g., "&" by "&"), so the replacement has to -- take this into account. P := 1; while (P + C'Length - 1) <= Length (S) loop if Slice (S, P, P + C'Length - 1) = C then Replace_Slice (S, P, P + C'Length - 1, R); P := P + R'Length; -- Skip over replacement string else P := P + 1; end if; end loop; else -- The string to be replaced is not present within the -- replacing string, so a simple find and replace can be -- done. loop P := Index (S, C); exit when P = 0; Replace_Slice (S, P, P + C'Length - 1, R); end loop; end if; end Replace_Special; ------------------------------------------------------------------------ function Replace_Specials (S : Unbounded_String; Subst : Boolean; Replace_Quotes : Boolean := False; Replace_Apos : Boolean := False) return Unbounded_String; function Replace_Specials (S : Unbounded_String; Subst : Boolean; Replace_Quotes : Boolean := False; Replace_Apos : Boolean := False) return Unbounded_String is New_S : Unbounded_String := S; begin if Subst then -- Ampersands must be replaced first, since the replacement -- strings contain ampersands Replace_Special ("&", "&", New_S); Replace_Special ("<", "<", New_S); Replace_Special ("]]>", "]]>", New_S); if Replace_Quotes then Replace_Special ("""", """, New_S); end if; if Replace_Apos then Replace_Special ("'", "'", New_S); end if; end if; return New_S; end Replace_Specials; ------------------------------------------------------------------------ -- Output the string in accordance with the specified format option. procedure Formatted_Put (F : in Output_Medium; S : in Unbounded_String; K : in XML_Component_Kind); procedure Formatted_Put (F : in Output_Medium; S : in Unbounded_String; K : in XML_Component_Kind) is -- The number of items in the element nesting stack is directly -- proportional to the amount of required indenting Indentation : constant Natural := Natural (Top_Of_Stack) * 3; Value : constant String := To_String (S); begin case K is when Header_Component => pragma Assert (Top_Of_Stack = 0); case Current_Format is when Continuous_Stream => Put (F, Value); when Spread_Indented => Put_Line (F, Value); end case; when Start_Tag_Component => case Current_Format is when Continuous_Stream => Put (F, Value); when Spread_Indented => Put (F, Indentation * ' '); Put_Line (F, Value); end case; when Content_Component => case Current_Format is when Continuous_Stream => Put (F, Value); when Spread_Indented => Put (F, Indentation * ' '); Put_Line (F, Value); end case; when End_Tag_Component => case Current_Format is when Continuous_Stream => Put (F, Value); when Spread_Indented => Put (F, Indentation * ' '); Put_Line (F, Value); end case; end case; end Formatted_Put; ------------------------------------------------------------------------ -- Output a standard XML header line, as amended by the supplied -- arguments. To omit the attribute, pass an empty string. -- procedure Output_XML_Header (F : in Output_Medium; Standalone : in Standalone_Values := Omit; Encoding : in String := "UTF-8"; Version : in String := "1.0") is Header : Unbounded_String := To_Unbounded_String (""); Formatted_Put (F, Header, Header_Component); else raise Invalid_Construction; end if; end Output_XML_Header; ------------------------------------------------------------------------ -- Add a processing instruction to the XML document. procedure Output_Processing_Instruction (F : in Output_Medium; Target : in String; Data : in String) is begin if Top_Of_Stack = 0 then Formatted_Put (F, To_Unbounded_String (""), Header_Component); else raise Invalid_Construction; end if; end Output_Processing_Instruction; ------------------------------------------------------------------------ -- Generate an entire element designated with the given tag and -- containing the provided content and list of attributes procedure Output_Element (F : in Output_Medium; Tag : in String; Content : in String; Attrs : in Attributes_List := No_Attributes; Subst : in Boolean := True) is Tag_Start : Unbounded_String := "<" & To_Unbounded_String (Tag); Tag_End : constant Unbounded_String := ""; begin if Attrs /= No_Attributes then for A in Attrs'Range loop if (Attrs (A).Value /= Null_Unbounded_String) or Default_Output_Null_Attributes then Append (Tag_Start, " " & Attrs (A).Attr & "=""" & Replace_Specials (Attrs (A).Value, Subst, Replace_Quotes => True, Replace_Apos => True) & """"); end if; end loop; end if; Append (Tag_Start, ">"); Formatted_Put (F, Tag_Start, Start_Tag_Component); Formatted_Put (F, Replace_Specials (To_Unbounded_String (Content), Subst), Content_Component); Formatted_Put (F, Tag_End, End_Tag_Component); end Output_Element; ------------------------------------------------------------------------ -- Generate an entire element designated with the given tag and -- containing the provided content single attribute specification procedure Output_Element (F : in Output_Medium; Tag : in String; Content : in String; Attrs : in Attribute_Value_Pairs; Subst : in Boolean := True) is begin Output_Element (F, Tag, Content, Attributes_List'(1 => Attrs), Subst); end Output_Element; ------------------------------------------------------------------------ -- Generate an entire element designated with the given tag and -- containing zero or more attributes. By default the element is -- created using the compact, no-end-tag notation; to force -- generation of an element that has both start and end tags and -- no content, set End_Tag to True. procedure Output_Tag (F : in Output_Medium; Tag : in String; Attrs : in Attributes_List := No_Attributes; End_Tag : in Boolean := False; Subst : in Boolean := True) is Tag_Start : Unbounded_String := "<" & To_Unbounded_String (Tag); Tag_End : constant Unbounded_String := ""; begin if Attrs /= No_Attributes then for A in Attrs'Range loop if (Attrs (A).Value /= Null_Unbounded_String) or Default_Output_Null_Attributes then Append (Tag_Start, " " & Attrs (A).Attr & "=""" & Replace_Specials (Attrs (A).Value, Subst, Replace_Quotes => True, Replace_Apos => True) & """"); end if; end loop; end if; if End_Tag then Append (Tag_Start, ">"); Formatted_Put (F, Tag_Start, Start_Tag_Component); Formatted_Put (F, Tag_End, End_Tag_Component); else Append (Tag_Start, "/>"); Formatted_Put (F, Tag_Start, Start_Tag_Component); end if; end Output_Tag; ------------------------------------------------------------------------ -- Generate an element tag with a single attribute specElementification. -- By default the element is created using the compact, no-end-tag -- notation; to force generation of an element that has both start -- and end tags and no content, set End_Tag to True. procedure Output_Tag (F : in Output_Medium; Tag : in String; Attrs : in Attribute_Value_Pairs; End_Tag : in Boolean := False; Subst : in Boolean := True) is begin Output_Tag (F, Tag, Attributes_List'(1 => Attrs), End_Tag, Subst); end Output_Tag; ------------------------------------------------------------------------ -- Initiate the generation of an XML element with the given tag and -- zero or more attribute specifications using an Attributes_List -- initializing aggregate. If there is only one attribute to be -- specified, the single attribute version of Start_Element may be -- used instead so as to avoid having to use named notation to -- specify the single element of the list. procedure Start_Element (F : in Output_Medium; Tag : in String; Attrs : in Attributes_List := No_Attributes; Subst : in Boolean := True) is Tag_Start : Unbounded_String := "<" & To_Unbounded_String (Tag); begin -- First output the tag and any attributes. if Attrs /= No_Attributes then for A in Attrs'Range loop if (Attrs (A).Value /= Null_Unbounded_String) or Default_Output_Null_Attributes then Append (Tag_Start, " " & Attrs (A).Attr & "=""" & Replace_Specials (Attrs (A).Value, Subst, Replace_Quotes => True, Replace_Apos => True) & """"); end if; end loop; end if; Append (Tag_Start, ">"); Formatted_Put (F, Tag_Start, Start_Tag_Component); Push (To_Unbounded_String (Tag)); end Start_Element; ------------------------------------------------------------------------ -- Initiate the generation of an XML element with the given tag and -- a single attribute specification. procedure Start_Element (F : in Output_Medium; Tag : in String; Attrs : in Attribute_Value_Pairs; Subst : in Boolean := True) is begin Start_Element (F, Tag, Attributes_List'(1 => Attrs), Subst); end Start_Element; ------------------------------------------------------------------------ -- Indicate the completion of the output of an XML element. If a -- Tag is specified, compare it against the element tag that is -- currently open, and raise Element_End_Mismatch if the two do -- not match. If there is no open element, then raise -- Element_Not_Open. procedure End_Element (F : in Output_Medium; Tag : in String := "") is Open_Tag : Unbounded_String; begin Pop (Open_Tag); -- Validate the tag only if one was supplied if (Tag = "") or else (Tag = To_String (Open_Tag)) then Formatted_Put (F, "", End_Tag_Component); else raise Element_End_Mismatch; end if; end End_Element; ------------------------------------------------------------------------ -- Place the text, as is, as the content of the currently open XML -- element. Output_Content can be called repeatedly, and will -- simply continue to append the additional content. If there is -- no open element, raise Element_Not_Open. procedure Output_Content (F : in Output_Medium; S : in String; Subst : in Boolean := True) is begin Formatted_Put (F, Replace_Specials (To_Unbounded_String (S), Subst), Content_Component); end Output_Content; ------------------------------------------------------------------------ -- Place the numeric Value, as a base 10 text representation, as -- the content of the currently open XML element. Output_Content -- can be called repeatedly, and will simply continue to append -- the additional content. If there is no open element, raise -- Element_Not_Open. procedure Output_Content (F : in Output_Medium; N : in Integer'Base) is N_Rep : constant String := Integer'Base'Image (N); Start_Index : constant Positive := Boolean'Pos (N >= 0) + 1; begin Output_Content (F, N_Rep (Start_Index .. N_Rep'Length)); end Output_Content; ------------------------------------------------------------------------ -- Place the text represenatation of the numeric Value as the -- content of the currently open XML element. Output_Content can -- be called repeatedly, and will simply continue to append the -- additional content. If there is no open element, raise -- Element_Not_Open. procedure Output_Content (F : in Output_Medium; N : in Float) is N_Rep : constant String := Float'Image (N); Start_Index : constant Positive := Boolean'Pos (N >= 0.0) + 1; begin Output_Content (F, N_Rep (Start_Index .. N_Rep'Length)); end Output_Content; ------------------------------------------------------------------------ -- The following overloaded "=" functions are the only means by -- which to create attribute/Value pairs. -- Attribute provided as String -- Associate an attribute with a string Value. function "=" (Attr : String; Value : String) return Attribute_Value_Pairs is begin return To_Unbounded_String (Attr) = To_Unbounded_String (Value); end "="; -- Associate an attribute with a string Value. function "=" (Attr : String; Value : Character) return Attribute_Value_Pairs is begin return To_Unbounded_String (Attr) = To_Unbounded_String ((1 => Value)); end "="; -- Associate an attribute with a string Value. function "=" (Attr : String; Value : Unbounded_String) return Attribute_Value_Pairs is begin return To_Unbounded_String (Attr) = Value; end "="; -- Associate an attribute with an integral Value. function "=" (Attr : String; Value : Integer'Base) return Attribute_Value_Pairs is Value_Rep : constant String := Integer'Base'Image (Value); Is_Natural : constant Boolean := Value >= 0; begin if Is_Natural then return Attr = Value_Rep (2 .. Value_Rep'Last); else return Attr = Value_Rep; end if; end "="; -- Associate an attribute with a floating point Value. function "=" (Attr : String; Value : Float) return Attribute_Value_Pairs is Value_Rep : constant String := Float'Image (Value); Is_Nonnegative : constant Boolean := Value >= 0.0; begin if Is_Nonnegative then return Attr = Value_Rep (2 .. Value_Rep'Last); else return Attr = Value_Rep; end if; end "="; -- Attribute provided as Unbounded_String -- Associate an attribute with a string Value. function "=" (Attr : Unbounded_String; Value : String) return Attribute_Value_Pairs is begin return Attr = To_Unbounded_String (Value); end "="; -- Associate an attribute with a string Value. function "=" (Attr : Unbounded_String; Value : Character) return Attribute_Value_Pairs is begin return Attr = To_Unbounded_String ((1 => Value)); end "="; -- Associate an attribute with a string Value. function "=" (Attr : Unbounded_String; Value : Unbounded_String) return Attribute_Value_Pairs is begin return (Attr, Value); end "="; -- Associate an attribute with an integral Value. function "=" (Attr : Unbounded_String; Value : Integer'Base) return Attribute_Value_Pairs is Value_Rep : constant String := Integer'Base'Image (Value); Is_Natural : constant Boolean := Value >= 0; begin if Is_Natural then return Attr = To_Unbounded_String (Value_Rep (2 .. Value_Rep'Last)); else return Attr = To_Unbounded_String (Value_Rep); end if; end "="; -- Associate an attribute with a floating point Value. function "=" (Attr : Unbounded_String; Value : Float) return Attribute_Value_Pairs is Value_Rep : constant String := Float'Image (Value); Is_Nonnegative : constant Boolean := Value >= 0.0; begin if Is_Nonnegative then return Attr = To_Unbounded_String (Value_Rep (2 .. Value_Rep'Last)); else return Attr = To_Unbounded_String (Value_Rep); end if; end "="; end McKae.XML.EZ_Out.Generic_Medium; libxmlezout-1.06.1.orig/mckae-xml-ez_out-generic_medium.ads0000644000175000017500000003072311635062074023611 0ustar lbrentalbrenta------------------------------------------------------------------------ -- -- -- McKae Software Utilities -- -- -- -- Copyright (C) 2005 McKae Technologies -- -- -- -- The McKae software utilities are free software; you can -- -- redistribute it and/or modify it under terms of the GNU General -- -- Public License as published by the Free Software Foundation; -- -- either version 2, or (at your option) any later version. McKae -- -- Software Utilities are distributed in the hope that they will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. You should -- -- have received a copy of the GNU General Public License distributed -- -- with DTraq; see file COPYING. If not, write to the Free Software -- -- Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -- -- USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- -- -- The McKae Software Utilities are maintained by McKae Technologies -- -- (http://www.mckae.com). -- ------------------------------------------------------------------------ with Ada.Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; generic type Output_Medium is limited private; with procedure Put (F : in Output_Medium; S : in String) is <>; with procedure New_Line (F : in Output_Medium; Spacing : in Ada.Text_IO.Positive_Count := 1) is <>; -- DEPRECATED -- Control formatting by setting the Current_Format variable in the -- package spec. -- -- Specify whether the XML that is created is to have indenting and -- line breaks. Format : Formatting_Options := Spread_Indented; -- DEPRECATED -- The maximum element nesting depth of an XML document Max_Element_Nesting : Positive := 200; package McKae.XML.EZ_Out.Generic_Medium is -------------------------------------------------------------------- -- This package provides the means to easily write XML elements and -- associated attributes to a provided medium that provides the -- required interface. -- Note that this package is designed in such a way that -- instantiations of it are meant to be "used" by the application. -- When accompanied with a "use" clause, specifying the XML to be -- produced is very simple and clear. Insisting on using qualified -- names will make for very obtuse code. Likewise, "named -- parameter" notation would obscure the complementarity of the Ada -- and XML, so apply for a waiver from any such style standards. ------------------------------------------------------------------- -- The medium must be open and ready to accept content before -- invoking any of these XML output subprograms. -- If the medium raises any exceptions as a result of invoking the -- supplied Put or New_Line procedures, those exceptions will be -- passed through to the caller. ------------------------------------------------------------------- -- The identation format of the XML that is output. This can be -- altered at any time. Current_Format : Formatting_Options := Format; -- Whether to output an attribute if it has a null value. Default_Output_Null_Attributes : Boolean := False; ------------------------------------------------------------------- -- These procedures for outputting XML header elements cannot be -- invoked when there are any nested elements opening, i.e., -- Start_Element has been called. Doing so will result in the -- raising of an Invalid_Construction exception. -- Settings for the document header's standalone attribute. type Standalone_Values is (Yes, No, Omit); -- Output a standard XML header line, as amended by the supplied -- arguments. To omit the attribute, pass an empty string. -- procedure Output_XML_Header (F : in Output_Medium; Standalone : in Standalone_Values := Omit; Encoding : in String := "UTF-8"; Version : in String := "1.0"); -- Add a processing instruction to the XML document. procedure Output_Processing_Instruction (F : in Output_Medium; Target : in String; Data : in String); ------------------------------------------------------------------- -- Representation of attribute/value pairs type Attribute_Value_Pairs is private; -- List of attributes and corresponding values to associated with -- an element type Attributes_List is array (Natural range <>) of Attribute_Value_Pairs; -- Indicator that the element has no associated attributes No_Attributes : constant Attributes_List; -- Generate an entire element designated with the given tag and -- containing the provided content and list of attributes procedure Output_Element (F : in Output_Medium; Tag : in String; Content : in String; Attrs : in Attributes_List := No_Attributes; Subst : in Boolean := True); -- Generate an entire element designated with the given tag and -- containing the provided content single attribute specification procedure Output_Element (F : in Output_Medium; Tag : in String; Content : in String; Attrs : in Attribute_Value_Pairs; Subst : in Boolean := True); -- Generate an element tag containing zero or more attributes. By -- default the element is created using the compact, no-end-tag -- notation; to force generation of an element that has both start -- and end tags and no content, set End_Tag to True. procedure Output_Tag (F : in Output_Medium; Tag : in String; Attrs : in Attributes_List := No_Attributes; End_Tag : in Boolean := False; Subst : in Boolean := True); -- Generate an element tag with a single attribute specification. -- By default the element is created using the compact, no-end-tag -- notation; to force generation of an element that has both start -- and end tags and no content, set End_Tag to True. procedure Output_Tag (F : in Output_Medium; Tag : in String; Attrs : in Attribute_Value_Pairs; End_Tag : in Boolean := False; Subst : in Boolean := True); -- Initiate the generation of an XML element with the given tag and -- zero or more attribute specifications using an Attributes_List -- initializing aggregate. If there is only one attribute to be -- specified, the single attribute version of Start_Element may be -- used instead so as to avoid having to use named notation to -- specify the single element of the list. procedure Start_Element (F : in Output_Medium; Tag : in String; Attrs : in Attributes_List := No_Attributes; Subst : in Boolean := True); -- Initiate the generation of an XML element with the given tag and -- a single attribute specification. procedure Start_Element (F : in Output_Medium; Tag : in String; Attrs : in Attribute_Value_Pairs; Subst : in Boolean := True); -- Indicate the completion of the output of an XML element. If a -- Tag is specified, compare it against the element tag that is -- currently open, and raise Element_End_Mismatch if the two do -- not match. If there is no open element, then raise -- Element_Not_Open. procedure End_Element (F : in Output_Medium; Tag : in String := ""); -- Place the text, as is, as the content of the currently open XML -- element. Output_Content can be called repeatedly, and will -- simply continue to append the additional content. If there is -- no open element, raise Element_Not_Open. procedure Output_Content (F : in Output_Medium; S : in String; Subst : in Boolean := True); -- Place the numeric value, as a base 10 text representation, as -- the content of the currently open XML element. Output_Content -- can be called repeatedly, and will simply continue to append -- the additional content. If there is no open element, raise -- Element_Not_Open. procedure Output_Content (F : in Output_Medium; N : in Integer'Base); -- Place the text represenatation of the numeric value as the -- content of the currently open XML element. Output_Content can -- be called repeatedly, and will simply continue to append the -- additional content. If there is no open element, raise -- Element_Not_Open. procedure Output_Content (F : in Output_Medium; N : in Float); -- The following overloaded "=" functions are the only means by -- which to create attribute/value pairs. -- Attribute provided as String -- Associate an attribute with a string value. function "=" (Attr : String; Value : String) return Attribute_Value_Pairs; -- Associate an attribute with a character value. function "=" (Attr : String; Value : Character) return Attribute_Value_Pairs; -- Associate an attribute with a string value. function "=" (Attr : String; Value : Unbounded_String) return Attribute_Value_Pairs; -- Associate an attribute with an integral value. function "=" (Attr : String; Value : Integer'Base) return Attribute_Value_Pairs; -- Associate an attribute with a floating point value. function "=" (Attr : String; Value : Float) return Attribute_Value_Pairs; -- Attribute provided as Unbounded_String -- Associate an attribute with a string value. function "=" (Attr : Unbounded_String; Value : String) return Attribute_Value_Pairs; -- Associate an attribute with a character value. function "=" (Attr : Unbounded_String; Value : Character) return Attribute_Value_Pairs; -- Associate an attribute with a string value. function "="(Attr : Unbounded_String; Value : Unbounded_String) return Attribute_Value_Pairs; -- Associate an attribute with an integral value. function "=" (Attr : Unbounded_String; Value : Integer'Base) return Attribute_Value_Pairs; -- Associate an attribute with a floating point value. function "=" (Attr : Unbounded_String; Value : Float) return Attribute_Value_Pairs; private type Attribute_Value_Pairs is record Attr : Unbounded_String; Value : Unbounded_String; end record; No_Attributes : constant Attributes_List (1 .. 0) := (others => (others => Null_Unbounded_String)); end McKae.XML.EZ_Out.Generic_Medium; libxmlezout-1.06.1.orig/mckae-xml-ez_out-string_stream.adb0000644000175000017500000001113511635062074023471 0ustar lbrentalbrenta------------------------------------------------------------------------ -- -- -- McKae Software Utilities -- -- -- -- Copyright (C) 2005-2009 McKae Technologies -- -- -- -- The McKae software utilities are free software; you can -- -- redistribute it and/or modify it under terms of the GNU General -- -- Public License as published by the Free Software Foundation; -- -- either version 2, or (at your option) any later version. McKae -- -- Software Utilities are distributed in the hope that they will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. You should -- -- have received a copy of the GNU General Public License distributed -- -- with DTraq; see file COPYING. If not, write to the Free Software -- -- Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -- -- USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- -- -- The McKae Software Utilities are maintained by McKae Technologies -- -- (http://www.mckae.com). -- ------------------------------------------------------------------------ with Unchecked_Deallocation; package body McKae.XML.EZ_Out.String_Stream is package body String_Buffering is procedure Free is new Unchecked_Deallocation (String, Buffer_Ptr); -- A basic in-memory string buffering package for building XML -- documents with EZ_Out. This is not intended to be a robust, -- full-function memory buffering package. procedure Extend (F : in String_Buffer; To_Add : in Positive); procedure Extend (F : in String_Buffer; To_Add : in Positive) is Temp_Buff : Buffer_Ptr := F.Buff; Size_Delta : Positive; Expansion_Factor : Positive; New_Size : constant Positive := F.Size + To_Add; begin if New_Size > F.Allocation then Size_Delta := New_Size - F.Allocation; Expansion_Factor := (Size_Delta / F.Expansion) + 1; F.Self.Sb.Allocation := F.Allocation + (Expansion_Factor * F.Expansion); F.Self.Sb.Buff := new String (1 .. F.Allocation); F.Self.Sb.Buff (1 .. F.Size) := Temp_Buff (1 .. F.Size); Free (Temp_Buff); end if; end Extend; -- Copy the given string into the buffer, expanding it if needed. procedure Put (F : in String_Buffer; S : in String) is begin if S'Length > 0 then Extend (F, S'Length); F.Buff (F.Size + 1 .. F.Size + S'Length) := S; F.Self.Sb.Size := F.Size + S'Length; end if; end Put; -- Insert a new line indicator into the buffer. procedure New_Line (F : in String_Buffer; Spacing : in Ada.Text_IO.Positive_Count := 1) is begin null; end New_Line; -- Clear the buffer procedure Clear (S : String_Buffer) is begin S.Self.Sb.Size := 0; end Clear; -- Free ressources in order to avoid memory leak procedure Full_Clear (S : in out String_Buffer) is begin Clear (S); Free (S.Buff); S.Buff := null; end Full_Clear; -- Return the current contents of the string buffer function Get_String (S : String_Buffer) return String is begin return S.Buff (1 .. S.Size); end Get_String; procedure Finalize (Object : in out String_Buffer) is begin Full_Clear (Object); end Finalize; end String_Buffering; end McKae.XML.EZ_Out.String_Stream; libxmlezout-1.06.1.orig/mckae-xml-ez_out-string_stream.ads0000644000175000017500000001724111635062074023516 0ustar lbrentalbrenta------------------------------------------------------------------------ -- -- -- McKae Software Utilities -- -- -- -- Copyright (C) 2005-2009 McKae Technologies -- -- -- -- The McKae software utilities are free software; you can -- -- redistribute it and/or modify it under terms of the GNU General -- -- Public License as published by the Free Software Foundation; -- -- either version 2, or (at your option) any later version. McKae -- -- Software Utilities are distributed in the hope that they will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. You should -- -- have received a copy of the GNU General Public License distributed -- -- with DTraq; see file COPYING. If not, write to the Free Software -- -- Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -- -- USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- -- -- The McKae Software Utilities are maintained by McKae Technologies -- -- (http://www.mckae.com). -- ------------------------------------------------------------------------ with Ada.Finalization; with Ada.Text_IO; use Ada.Text_IO; with McKae.XML.EZ_Out.Generic_Medium; package McKae.XML.EZ_Out.String_Stream is -- A basic in-memory string-based XML document construction -- utility. This is not intended to be a robust, full-function -- memory buffering package. --------------------------------------------------------------------------- -- This nested package provides a basic string-based buffering -- capability. The purpose of the EZ_Out String_Stream package is -- to provide a simple means of constructing an XML document in a -- memory buffer. To do this, a memory buffering capability was -- needed--there were three approaches: -- -- o Locate and employ an existing memory buffering component, -- modifying it as needed to provide the required Put and New_Line -- functions -- o Write a McKae component to do memory buffering and reference -- it in this package. -- o Embed a memory buffering capability within the String_Stream -- package. -- -- The first option was discarded not because there's anything -- wrong with existing memory buffer components, but rather -- because of questions about which one should be chosen, what are -- its distribution and modification requirements, and so on. The -- truth of the matter is that this approach is what a project -- using EZ_Out for a project actually ought to do--take their -- memory buffering capability, enhance it with Put and New_Line -- functionality, and then instantiate EZ_Out.Generic_Medium with -- it. -- -- The second option was discarded because the focus of EZ_Out is -- on XML document generation, not providing a general purpose -- memory buffering component. While a limited capability one -- could have been created, it would be over-specific to EZ_Out -- and its (intentional) limitations would distract from its -- intended use as an EZ_Out adjunct package. -- -- This left the third option. By embedding the above-mentioned -- limited capability memory buffering capability within -- String_Stream, it's clearly associated as just an aspect of the -- String_Stream implementation, as any relevant capabilities -- are simply exported by the String_Stream package. package String_Buffering is -- There's little point in having a small buffer for building XML -- documents, so the minimum size and expansion is 500 characters. subtype Buffer_Size_Range is Positive range 500 .. Positive'Last; type String_Buffer is limited private; -- Copy the given string into the buffer, expanding it if needed. procedure Put (F : in String_Buffer; S : in String); -- Insert a new line indicator into the buffer. However, in -- this case do nothing, since this buffering package is being -- instantiated for Continuous_Stream formatting. procedure New_Line (F : in String_Buffer; Spacing : in Ada.Text_IO.Positive_Count := 1); -- Clear the buffer. Note that this does not free any allocated -- resources. procedure Clear (S : String_Buffer); -- Free ressources in order to avoid memory leak procedure Full_Clear (S : in out String_Buffer); -- Return the current contents of the string buffer function Get_String (S : String_Buffer) return String; private -- Handle to the buffer type Buffer_Ptr is access all String; -- String buffer self-access ("Rosen Trick"); type String_Self_Access (SB : access String_Buffer) is limited null record; -- String buffer type definition. By default, a newly created -- string buffer is initialized to be empty. Init_Size : constant := 5000; type String_Buffer is new Ada.Finalization.Limited_Controlled with record Initial_Size : Buffer_Size_Range := Init_Size; Expansion : Buffer_Size_Range := 5000; Allocation : Buffer_Size_Range := Init_Size; Size : Natural := 0; Buff : Buffer_Ptr := new String (1 .. Init_Size); Self : String_Self_Access (String_Buffer'Access); end record; -- Release the string buffer's resources when the buffer goes -- out of scope procedure Finalize (Object : in out String_Buffer); end String_Buffering; --------------------------------------------------------------------------- subtype Buffer_Size_Range is String_Buffering.Buffer_Size_Range; subtype String_Buffer is String_Buffering.String_Buffer; -- Clear the buffer. Note that this does not free any allocated -- resources. procedure Clear (S : String_Buffer) renames String_Buffering.Clear; -- Free ressources in order to avoid memory leak procedure Full_Clear (S : in out String_Buffer) renames String_Buffering.Full_Clear; -- Return the current contents of the string buffer function Get_String (S : String_Buffer) return String renames String_Buffering.Get_String; --------------------------------------------------------------------------- -- "Use" this XML_String_Buffer package for constructing an EZ_Out -- XML document. package XML_String_Buffer is new McKae.XML.EZ_Out.Generic_Medium (Output_Medium => String_Buffering.String_Buffer, Put => String_Buffering.Put, New_Line => String_Buffering.New_Line, Format => Continuous_Stream); --------------------------------------------------------------------------- end McKae.XML.EZ_Out.String_Stream; libxmlezout-1.06.1.orig/mckae-xml-ez_out-text_file.ads0000644000175000017500000000442711635062074022622 0ustar lbrentalbrenta------------------------------------------------------------------------ -- -- -- McKae Software Utilities -- -- -- -- Copyright (C) 2005 McKae Technologies -- -- -- -- The McKae software utilities are free software; you can -- -- redistribute it and/or modify it under terms of the GNU General -- -- Public License as published by the Free Software Foundation; -- -- either version 2, or (at your option) any later version. McKae -- -- Software Utilities are distributed in the hope that they will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. You should -- -- have received a copy of the GNU General Public License distributed -- -- with DTraq; see file COPYING. If not, write to the Free Software -- -- Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -- -- USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- -- -- The McKae Software Utilities are maintained by McKae Technologies -- -- (http://www.mckae.com). -- ------------------------------------------------------------------------ with McKae.XML.EZ_Out.Generic_Medium; with Ada.Text_IO; use Ada.Text_IO; package McKae.XML.EZ_Out.Text_File is new McKae.XML.EZ_Out.Generic_Medium (Output_Medium => Ada.Text_IO.File_Type); libxmlezout-1.06.1.orig/mckae-xml-ez_out.ads0000644000175000017500000000621211635062074020633 0ustar lbrentalbrenta------------------------------------------------------------------------ -- -- -- McKae Software Utilities -- -- -- -- Copyright (C) 2005 McKae Technologies -- -- -- -- The McKae software utilities are free software; you can -- -- redistribute it and/or modify it under terms of the GNU General -- -- Public License as published by the Free Software Foundation; -- -- either version 2, or (at your option) any later version. McKae -- -- Software Utilities are distributed in the hope that they will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. You should -- -- have received a copy of the GNU General Public License distributed -- -- with DTraq; see file COPYING. If not, write to the Free Software -- -- Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -- -- USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- -- -- The McKae Software Utilities are maintained by McKae Technologies -- -- (http://www.mckae.com). -- ------------------------------------------------------------------------ package McKae.XML.EZ_Out is -- This package is the parent package for a collection of packages -- that provide a simple means of XML output generation to a -- variety of output media. -- Continuous_Stream : No indenting, line breaks, or other -- extraneous whitespace. -- Spread_Indented : Start and end tags are indented, and -- each resides on its own line. type Formatting_Options is (Continuous_Stream, Spread_Indented ); Element_Not_Open : exception; -- An attempt was made to end, or add content to, an element when -- there were no open elements awaiting text or completion. Element_End_Mismatch : exception; -- The specified end tag does not match that of the currently open -- element. Nesting_Too_Deep : exception; -- The number of open, nested elements has exceeded the maximum -- level that was specified. Invalid_Construction : exception; -- An attempt was made to create a malformed document, such as -- inserting a process instruction into an open element. end McKae.XML.EZ_Out; libxmlezout-1.06.1.orig/mckae-xml.ads0000644000175000017500000000417411635062074017335 0ustar lbrentalbrenta------------------------------------------------------------------------ -- -- -- McKae Software Utilities -- -- -- -- Copyright (C) 2004 McKae Technologies -- -- -- -- The McKae software utilities are free software; you can -- -- redistribute it and/or modify it under terms of the GNU General -- -- Public License as published by the Free Software Foundation; -- -- either version 2, or (at your option) any later version. McKae -- -- Software Utilities are distributed in the hope that they will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. You should -- -- have received a copy of the GNU General Public License distributed -- -- with DTraq; see file COPYING. If not, write to the Free Software -- -- Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -- -- USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- -- -- The McKae Software Utilities are maintained by McKae Technologies -- -- (http://www.mckae.com). -- ------------------------------------------------------------------------ package McKae.XML is pragma Pure; end McKae.XML; libxmlezout-1.06.1.orig/mckae.ads0000644000175000017500000000416311635062074016535 0ustar lbrentalbrenta------------------------------------------------------------------------ -- -- -- McKae Software Utilities -- -- -- -- Copyright (C) 2003 McKae Technologies -- -- -- -- The McKae software utilities are free software; you can -- -- redistribute it and/or modify it under terms of the GNU General -- -- Public License as published by the Free Software Foundation; -- -- either version 2, or (at your option) any later version. McKae -- -- Software Utilities are distributed in the hope that they will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. You should -- -- have received a copy of the GNU General Public License distributed -- -- with DTraq; see file COPYING. If not, write to the Free Software -- -- Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -- -- USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- -- -- The McKae Software Utilities are maintained by McKae Technologies -- -- (http://www.mckae.com). -- ------------------------------------------------------------------------ package McKae is pragma Pure; end McKae; libxmlezout-1.06.1.orig/tmeztf.adb0000644000175000017500000001423511635062074016746 0ustar lbrentalbrentawith Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Text_Io; use Text_IO; with Mckae.Xml.Ez_Out.Generic_Medium; with Mckae.Xml.Ez_Out.Text_File; use Mckae.Xml.Ez_Out.Text_File; with Mckae.XML.Ez_Out.String_Stream; procedure Tmeztf is use Mckae.Xml.Ez_Out; use String_Stream; use XML_String_Buffer; package Ezcs is new Mckae.Xml.Ez_Out.Generic_Medium (File_Type, Put, New_Line, Continuous_Stream); use Ezcs; package Ezsi is new Mckae.Xml.Ez_Out.Generic_Medium (File_Type, Put, New_Line, Spread_Indented); use Ezsi; State : Unbounded_String := To_Unbounded_String("state"); Zip : Unbounded_String := To_Unbounded_String("zipcode"); MN : Unbounded_String := To_Unbounded_String("MN"); Bud : Unbounded_String := To_Unbounded_String("Bud"); Ss : Mckae.Xml.Ez_Out.String_Stream.String_Buffer (500, 500); begin Put_Line("Continuous Stream:"); New_Line; Ezcs.Output_Xml_Header(Standard_Output); Ezcs.Output_Processing_Instruction(Standard_Output, "stylesheet", "bob.xsl"); Ezcs.Start_Element(Standard_Output, "parent", "name" = "jones"); Ezcs.Output_Tag(Standard_Output, "child", ("name" = "jane", "sex" = 'F', "age" = 7, "height"=54.7)); Ezcs.Output_Tag(Standard_Output, "child", ("name" = "Tom", "sex" = 'M', "age" = 4, "height"=44.7)); Ezcs.Output_Tag(Standard_Output, "residence", (State = "AL", Zip = 35806, "temp" = -2)); Ezcs.Output_Element(Standard_Output, "child", "Third and last", ("name" = "Tom", "age" = 1, "height"=24.7)); Ezcs.End_Element(Standard_Output, "parent"); New_Line(2); Put_Line("Indented:"); New_Line; Ezsi.Output_Xml_Header(Standard_Output); Ezsi.Output_Processing_Instruction(Standard_Output, "stylesheet", "bob.xsl"); Ezsi.Output_Tag(Standard_Output, "fred", (("tom" = "harry"), ("mike" = 32))); Ezsi.Start_Element(Standard_Output, "parent", "name" = "jones"); Ezsi.Output_Tag(Standard_Output, "child", ("name" = "jane", "age" = 7, "height"=54.7)); Ezsi.Output_Tag(Standard_Output, "child", ("name" = "Tom", "age" = 4, "height"=44.7)); Ezsi.Output_Tag(Standard_Output, "associate", "name" = Bud); Ezsi.Start_Element(Standard_Output, "child", ("name" = "Tom", "age" = 1, "height"=24.7)); Ezsi.Output_Content(Standard_Output, "Keeping up the Joneses"); Ezsi.End_Element(Standard_Output); Ezsi.End_Element(Standard_Output, "parent"); New_Line; Put_Line("Text File output:"); New_Line; Text_File.Output_Xml_Header(Standard_Output); Text_File.Output_Processing_Instruction(Standard_Output, "stylesheet", "bob.xsl"); Text_File.Start_Element(Standard_Output, "parent", "name" = "jones"); Text_File.Output_Tag(Standard_Output, "child", ("name" = "jane", "age" = 7, "height"=54.7)); Text_File.Output_Tag(Standard_Output, "child", ("name" = "Tom", "age" = 4, "height"=44.7)); Text_File.Output_Element(Standard_Output, "child", "Third", ("name" = "Tom", "age" = 1, "height"=24.7)); Text_File.Output_Element(Standard_Output, "child", "Fourth & last", ("name" = "Tom", "age" = 1, "height"=24.7)); Text_File.Output_Tag(Standard_Output, "fred", (("tom" = "harry"), ("mike" = 32))); Text_File.Output_Tag(Standard_Output, "residence", (State = "", Zip = 55067)); -- Change the setting for outputting null-valued attributes. Text_File.Default_Output_Null_Attributes := True; Text_File.Output_Tag(Standard_Output, "undercover", (State = "", Zip = 55067)); Text_File.End_Element(Standard_Output, "parent"); New_Line(2); Put_Line("String stream output:"); New_Line; Xml_String_Buffer.Output_Xml_Header(Ss); Xml_String_Buffer.Output_Processing_Instruction(Ss, "stylesheet", "bob.xsl"); Xml_String_Buffer.Start_Element(Ss, "parent", "name" = "jones"); Xml_String_Buffer.Output_Tag(Ss, "child", ("name" = "jane", "age" = 7, "height"=54.7)); Xml_String_Buffer.Output_Tag(Ss, "child", ("name" = "Tom", "age" = 4, "height"=44.7)); Xml_String_Buffer.Output_Element(Ss, "child", "Third and last", ("name" = "Tom", "age" = 1, "height"=24.7)); Xml_String_Buffer.Output_Tag(Ss, "fred", (("tom" = "harry"), ("mike" = 32))); Xml_String_Buffer.End_Element(Ss, "parent"); Put_Line(String_Stream.Get_String(Ss)); end Tmeztf; libxmlezout-1.06.1.orig/xml_ez_out.gpr0000644000175000017500000000024211635062074017655 0ustar lbrentalbrentaproject Xml_Ez_Out is for Main use ("tmeztf.adb"); package Compiler is for Default_Switches ("ada") use ("-O2"); end Compiler; end Xml_Ez_Out; libxmlezout-1.06.1.orig/xmlezout.gpr0000644000175000017500000000226511635062074017366 0ustar lbrentalbrenta-- XML EZ OUT library project file for use with GCC 4.4 -- Copyright (c) 2009 Xavier Grave -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- This project file is designed to help build applications that use -- XML EZ OUT. Here is an example of how to use this project file: -- -- with "xmlezout"; -- project Example is -- for Object_Dir use "obj"; -- for Exec_Dir use "."; -- for Main use ("example"); -- end Example; project XmlEzOut is for Library_Name use "xmlezout"; for Library_Dir use "../lib/xmlezout"; for Library_Kind use "dynamic"; for Source_Dirs use ("xmlezout"); for Library_ALI_Dir use "../lib/xmlezout"; for Externally_Built use "true"; end XmlEzOut;