Opened 10 years ago

Closed 10 years ago

#20 closed defect (fixed)

Unable to parse two diffrent strings with the same Source and Reader.

Reported by: alexander.basov Owned by: somebody
Priority: blocker Milestone: 0.0.6
Component: Matreshka - XML Processor Version:
Keywords: Cc:

Description

I've modified SAX_Events_Printer example as follow :

with Ada.Command_Line;

with League.Strings;
with XML.SAX.Input_Sources.Strings;
with XML.SAX.Simple_Readers;

with Events_Printers;
with Put_Line;
use League.Strings;
procedure Sax_Events_Printer is
   Source  : aliased XML.SAX.Input_Sources.Strings.String_Input_Source;
   Reader  : aliased XML.SAX.Simple_Readers.SAX_Simple_Reader;
   Handler : aliased Events_Printers.Events_Printer;

   X1 : Wide_Wide_String := "<A x='y'> sdfsad </A>";
   X2 : Wide_Wide_String := "<B z='q'> iopuio </B>";

begin
   XML.SAX.Simple_Readers.Put_Line := Put_Line'Access;
   Reader.Set_Content_Handler (Handler'Unchecked_Access);
   Reader.Set_Declaration_Handler (Handler'Unchecked_Access);
   Reader.Set_DTD_Handler (Handler'Unchecked_Access);
   Reader.Set_Entity_Resolver (Handler'Unchecked_Access);
   Reader.Set_Error_Handler (Handler'Unchecked_Access);
   Reader.Set_Lexical_Handler (Handler'Unchecked_Access);

   Source.Set_String (To_Universal_String (X1));
   Reader.Parse (Source'Access);

   Source.Set_String (To_Universal_String (X2));
   Reader.Parse (Source'Access);
end Sax_Events_Printer;

When I try to run it,
It prints informatation about A tag, but no any information about B tag.

./sax_events_printer 
>>> (Start_Element) 1:9: '' 'A' 'A'
                    '' 'x' 'x' 'y'
>>> (Characters) 1:10: ' sdfsad '
>>> (End_Element) 1:21: '' 'A' 'A'

Attachments (1)

sax_events_printer.adb.patch (1.3 KB ) - added by alexander.basov 10 years ago.
path for bug reproduction

Download all attachments as: .zip

Change History (3)

by alexander.basov, 10 years ago

path for bug reproduction

comment:1 by vadim.godunko, 10 years ago

(In [881]) Add automated test for #20.

Refs #20.

comment:2 by vadim.godunko, 10 years ago

Milestone: 0.1
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.