mirror of
https://github.com/AdaCore/xmlada.git
synced 2026-02-12 12:30:28 -08:00
For the purpose of sanity checking xmlada on VxWorks (and possibly other cross platforms), add cross-comilable examples, one per dom, sax and schema, that have all xml/xsd sources embedded in the test's main. Add new cross- and existing examples to the installation of xmlada. Change-Id: I56848955171a3b1f16f38bc3ecd7cef253af6346
51 lines
1.4 KiB
Ada
51 lines
1.4 KiB
Ada
--
|
|
-- Copyright (C) 2017, AdaCore
|
|
--
|
|
|
|
with Unicode.CES; use Unicode.CES;
|
|
with Sax.Attributes; use Sax.Attributes;
|
|
with Ada.Text_IO; use Ada.Text_IO;
|
|
|
|
package body SaxExample is
|
|
|
|
procedure Start_Element
|
|
(Handler : in out Reader;
|
|
Namespace_URI : Unicode.CES.Byte_Sequence := "";
|
|
Local_Name : Unicode.CES.Byte_Sequence := "";
|
|
Qname : Unicode.CES.Byte_Sequence := "";
|
|
Atts : Sax.Attributes.Attributes'Class)
|
|
is
|
|
begin
|
|
Handler.Current_Pref := Null_Unbounded_String;
|
|
Handler.Current_Value := Null_Unbounded_String;
|
|
|
|
if Local_Name = "pref" then
|
|
Handler.Current_Pref :=
|
|
To_Unbounded_String (Get_Value (Atts, "name"));
|
|
end if;
|
|
end Start_Element;
|
|
|
|
procedure Characters
|
|
(Handler : in out Reader;
|
|
Ch : Unicode.CES.Byte_Sequence) is
|
|
begin
|
|
if Handler.Current_Pref /= Null_Unbounded_String then
|
|
Handler.Current_Value := Handler.Current_Value & Ch;
|
|
end if;
|
|
end Characters;
|
|
|
|
procedure End_Element
|
|
(Handler : in out Reader;
|
|
Namespace_URI : Unicode.CES.Byte_Sequence := "";
|
|
Local_Name : Unicode.CES.Byte_Sequence := "";
|
|
Qname : Unicode.CES.Byte_Sequence := "")
|
|
is
|
|
begin
|
|
if Local_Name = "pref" then
|
|
Put_Line ("Value for """ & To_String (Handler.Current_Pref)
|
|
& """ is " & To_String (Handler.Current_Value));
|
|
end if;
|
|
end End_Element;
|
|
|
|
end SaxExample;
|