All pastes #450888 Raw Edit

Someone

public text v1 · immutable
·published 2007-04-21 03:29 UTC
rendered paste body
with Ada.Strings.Unbounded;

package XML is
   type Attribute is limited private;
   type Element is limited private;
   
   function Create (Name : String) return Element;
   function Create (Name, Value : String) return Attribute;
   
   procedure Add_Child   (To : in Element; Item : in Element);
   procedure Add_Sibling (To : in Element; Item : in Element);
   procedure Add_Attr    (To : in Element; Item : in Attribute);
private
   type Attribute_Type;
   type Attribute is access Attribute_Type;
   type Attribute_Type is
      record
	 Name, Value : Ada.Strings.Unbounded.Unbounded_String;
	 Next        : Attribute;
      end record;
   
   type Element_Type;
   type Element is access Element_Type;
   type Element_Type is
      record
	 Name, Value : Ada.Strings.Unbounded.Unbounded_String;
	 Attrs       : Attribute;
	 Next, Child : Element;
      end record;
   
   type Document_Type;
   type Document is access Document_Type;
   type Document_Type is
      record
	 Name  : Ada.Strings.Unbounded.Unbounded_String;
	 Child : Element;
      end record;
   
end XML;
package body XML is
--   function Create return Document is
--   begin
--      return new Document_Type;
--   end Create;

   function Create (Name : String) return Element is
   begin
      return new Element_Type;
   end Create;

   function Create (Name, Value : String) return Attribute is
   begin
      return new Attribute_Type;
   end Create;

   procedure Add_Child (To : in Element; Item : in Element) is
   begin
      null;
   end Add_Child;

   procedure Add_Sibling (To : in Element; Item : in Element) is
   begin
      null;
   end Add_Sibling;

   procedure Add_Attr (To : in Element; Item : in Attribute) is
   begin
      null;
   end Add_Attr;
end XML;