/usr/share/ada/adainclude/aws/soap-xml.adb is in libaws2.10.2-dev 2.10.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2003-2009, AdaCore --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
with Ada.Characters.Handling;
with DOM.Core.Nodes;
with SOAP.Utils;
package body SOAP.XML is
-----------------
-- First_Child --
-----------------
function First_Child (Parent : DOM.Core.Node) return DOM.Core.Node is
use type DOM.Core.Node;
use type DOM.Core.Node_Types;
N : DOM.Core.Node;
begin
N := DOM.Core.Nodes.First_Child (Parent);
while N /= null
and then (N.Node_Type = DOM.Core.Text_Node
or else N.Node_Type = DOM.Core.Comment_Node)
loop
-- DOM.Core.Nodes.Node_Name (N) = "#text" loop
N := DOM.Core.Nodes.Next_Sibling (N);
end loop;
return N;
end First_Child;
--------------------
-- Get_Attr_Value --
--------------------
function Get_Attr_Value
(N : DOM.Core.Node;
Name : String;
NS : Boolean := True) return String
is
use type DOM.Core.Node;
A : DOM.Core.Node;
begin
A := DOM.Core.Nodes.Get_Named_Item (DOM.Core.Nodes.Attributes (N), Name);
if A = null then
return "";
else
declare
V : constant String := DOM.Core.Nodes.Node_Value (A);
begin
if NS then
return V;
else
return Utils.No_NS (V);
end if;
end;
end if;
end Get_Attr_Value;
-------------
-- Get_Ref --
-------------
function Get_Ref (N : DOM.Core.Node) return DOM.Core.Node is
use type DOM.Core.Node;
function Body_Node (N : DOM.Core.Node) return DOM.Core.Node;
-- Returns Payload body node for N being inside this node
---------------
-- Body_Node --
---------------
function Body_Node (N : DOM.Core.Node) return DOM.Core.Node is
L_N : DOM.Core.Node := N;
begin
while Ada.Characters.Handling.To_Lower
(Utils.No_NS (DOM.Core.Nodes.Local_Name (L_N))) /= "body"
loop
L_N := DOM.Core.Nodes.Parent_Node (L_N);
end loop;
return L_N;
end Body_Node;
Atts : constant DOM.Core.Named_Node_Map := DOM.Core.Nodes.Attributes (N);
Href : constant DOM.Core.Node
:= DOM.Core.Nodes.Get_Named_Item (Atts, "href");
HN : DOM.Core.Node;
begin
if Href = null then
return N;
else
HN := XML.First_Child (Body_Node (N));
declare
Id : constant String := DOM.Core.Nodes.Node_Value (Href);
-- This is the Id we are looking for
begin
-- We have an href, look for the corresponding node
while "#" & XML.Get_Attr_Value (HN, "id") /= Id loop
HN := DOM.Core.Nodes.Next_Sibling (HN);
end loop;
return HN;
end;
end if;
end Get_Ref;
------------------
-- Next_Sibling --
------------------
function Next_Sibling (N : DOM.Core.Node) return DOM.Core.Node is
use type DOM.Core.Node;
use type DOM.Core.Node_Types;
M : DOM.Core.Node := N;
begin
loop
M := DOM.Core.Nodes.Next_Sibling (M);
exit when M = null
or else (M.Node_Type /= DOM.Core.Text_Node
and then M.Node_Type /= DOM.Core.Comment_Node);
end loop;
return M;
end Next_Sibling;
end SOAP.XML;
|