File: saxexample_main.adb

package info (click to toggle)
libxmlada 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,212 kB
  • sloc: ada: 78,068; sh: 3,310; makefile: 394; xml: 111; python: 39
file content (34 lines) | stat: -rw-r--r-- 971 bytes parent folder | download | duplicates (4)
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
--
--  Copyright (C) 2017, AdaCore
--

with Input_Sources.Strings; use Input_Sources.Strings;
with Unicode.CES;           use Unicode.CES;
with Unicode.CES.Utf8;

with Sax.Readers;        use Sax.Readers;
with SaxExample;         use SaxExample;

procedure SaxExample_Main is
   My_Reader : SaxExample.Reader;
   Input     : String_Input;

   XML_Source_String : constant Unicode.CES.Byte_Sequence :=
     "<?xml version=""1.0"" ?>"
     & "<preferences>"
     & "<pref name=""pref1"">Value1</pref>"
     & "<pref name=""pref2"">Value2</pref>"
     & "</preferences> ";
begin
   Set_Public_Id (Input, "Preferences file");
   Set_System_Id (Input, "pref.xml");
   Open (XML_Source_String, Unicode.CES.Utf8.Utf8_Encoding, Input);

   Set_Feature (My_Reader, Namespace_Prefixes_Feature, False);
   Set_Feature (My_Reader, Namespace_Feature, False);
   Set_Feature (My_Reader, Validation_Feature, False);

   Parse (My_Reader, Input);

   Close (Input);
end SaxExample_Main;