File: dom-core-elements.ads

package info (click to toggle)
libxmlada1 1.0-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,704 kB
  • ctags: 94
  • sloc: ada: 22,582; sh: 1,804; makefile: 142; xml: 140; perl: 128
file content (127 lines) | stat: -rw-r--r-- 5,734 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
-----------------------------------------------------------------------
--                XML/Ada - An XML suite for Ada95                   --
--                                                                   --
--                       Copyright (C) 2001-2002                     --
--                            ACT-Europe                             --
--                                                                   --
-- This library 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 2 of the License, or (at your option) any later version.  --
--                                                                   --
-- This library 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.                          --
--                                                                   --
-- You should have received a copy of the GNU General Public         --
-- License along with this library; if not, write to the             --
-- Free Software Foundation, Inc., 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.     --
-----------------------------------------------------------------------

with DOM.Core.Nodes;   use DOM.Core.Nodes;

package DOM.Core.Elements is

   function Get_Tag_Name (Elem : Element) return DOM_String
      renames DOM.Core.Nodes.Node_Value;
   --  Return the tag of the element

   --------------------------
   -- Attributes by string --
   --------------------------

   function Get_Attribute (Elem : Element; Name : DOM_String)
      return DOM_String;
   --  Return the value of a specific attribute, or the empty string if the
   --  attribute is unknown and doesn't have a default value.
   --  Use Get_Attribute_NS for a namespace-compatible version.

   function Get_Attribute_NS
     (Elem : Element; Namespace_URI : DOM_String; Local_Name : DOM_String)
      return DOM_String;
   --  Like Get_Attribute but provides namespace support

   procedure Set_Attribute
     (Elem : Element; Name : DOM_String; Value : DOM_String);
   --  Set the value of a specific attribute. The attribute is created if it
   --  doesn't exist yet.
   --  Note that Value is not parsed, thus any entity markup will not be
   --  expanded. Use Set_Attribute_Node if you need to create an attribute
   --  that contains an entity reference.
   --  Use Set_Attribute_NS for a namespace-compatible version.
   --  Invalid_Character_Err raised if Name contains an illegal character.

   procedure Set_Attribute_NS
     (Elem : Element;
      Namespace_URI : DOM_String;
      Qualified_Name : DOM_String;
      Value : DOM_String);
   --  Like Set_Attribute, but provides namespace support

   procedure Remove_Attribute (Elem : Element; Name : DOM_String);
   --  Remove an attribute by name. If there is a defaul value for that
   --  attribute, it is reset.
   --  Use Remove_Attribute_NS for a namespace-compatible version.

   procedure Remove_Attribute_NS
     (Elem : Element; Namespace_URI : DOM_String; Local_Name : DOM_String);
   --  Like Remove_Attribute, but provides namespace support

   ------------------------
   -- Attributes by node --
   ------------------------

   function Get_Attribute_Node (Elem : Element; Name : DOM_String) return Attr;
   --  Return the attribute node for a specific name

   function Get_Attribute_Node_NS
     (Elem : Element; Namespace_URI : DOM_String; Local_Name : DOM_String)
      return Attr;
   --  Like Get_Attribute_Node but provides namespace support

   function Set_Attribute_Node (Elem : Element; New_Attr : Attr) return Attr;
   --  Set or override a given attribute.
   --  Inuse_Attribute_Err raised if New_Attr belongs to another element

   function Set_Attribute_Node_NS (Elem : Element; New_Attr : Attr)
      return Attr;
   --  Like Set_Attribute, but provides namespace support

   function Remove_Attribute_Node (Elem : Element; Old_Attr : Attr)
      return Attr;
   --  Remove an attribute, and return it.
   --  If Old_Attr doesn't belong to Elem, null is returned.

   function Remove_Attribute_Node_NS (Elem : Element; Old_Attr : Attr)
      return Attr;
   --  Like Remove_Attribute, but provides namespace support

   --------------
   -- Elements --
   --------------

   function Get_Elements_By_Tag_Name (Elem : Element; Name : DOM_String := "*")
      return Node_List;
   --  Returns a NodeList of all descendant elements with a given tag name,
   --  in the order in which they would be encountered in a preorder traversal
   --  of the Element tree.
   --  The special value "*" matches all tags

   function Get_Elements_By_Tag_Name_NS
     (Elem : Element;
      Namespace_URI : DOM_String := "*";
      Local_Name : DOM_String := "*")
      return Node_List;
   --  Same as Get_Elements_By_Tag_Name, but provides namespacesupport.
   --  "*" matches all namespaces or all local_names.

end DOM.Core.Elements;