[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]  


Package Glib.XML

This package provides a simple minded XML parser to be used with Gate.

Types

type Node is record
    Tag   : String_Ptr;
      -- The name of this node
    
    Attributes   : String_Ptr;
      -- The attributes of this node
    
    Value : String_Ptr;
      -- The value, or null is not relevant
    
    Parent : Node_Ptr;
      -- The parent of this Node.
    
    Child : Node_Ptr;
      -- The first Child of this Node. The next child is Child.Next
    
    Next  : Node_Ptr;
      -- Next "brother" node.
    
    Specific_Data : XML_Specific_Data;
      -- Use to store data specific to each implementation (e.g a boolean
      -- indicating whether this node has been accessed)
    end record;

A node of the XML tree. Each time a tag is found in the XML file, a new node is created, that points to its parent, its children and its siblings (nodes at the same level in the tree and with the same parent).


type Node_Ptr is access all Node;

Pointer to a node of the XML tree.


type XML_Specific_Data is private;

The type of the extra data that can be attached to each node of the XML tree. See for instance the package Glib.Glade.


Subprograms

function Parse                 
  (File               :        String)
   return Node_Ptr;

Parse File and return the first node representing the XML file.


procedure Print                
  (N                  :        Node_Ptr;
   Indent             :        Natural := 0);

Simple print procedure. Print the whole tree starting with N.


function Find_Tag              
  (N                  :        Node_Ptr;
   Tag                :        String)
   return Node_Ptr;

Find a tag Tag in N and its brothers.


function Get_Field             
  (N                  :        Node_Ptr;
   Field              :        String)
   return String_Ptr;

Return the value of the field 'Field' if present in the children of N.
Return null otherwise.


function Get_Attribute         
  (N                  : in     Node_Ptr;
   Attribute_Name     : in     String)
   return String_Ptr;

Return the value of the attribute 'Attribute_Name' if present.
Return null otherwise.



[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]