comp.lang.ada
 help / color / mirror / Atom feed
From: "björn lundin" <b.f.lundin@gmail.com>
Subject: xml/ada dropping data when pre-defined entities are separated by space?
Date: Thu, 27 Jan 2011 02:06:06 -0800 (PST)
Date: 2011-01-27T02:06:06-08:00	[thread overview]
Message-ID: <05aafe44-cdd9-4c28-8e3f-24ecd9067ab3@u6g2000vbh.googlegroups.com> (raw)

Hi !
I wonder if anyone has encountered difficulties with xml/ada
when parsing documents containing the pre-defined entities like &amp;

When having one of these, it is ok, but if two appear, separated with
space,
the rest of the text is dropped.

This is with xml/ada 3.2.1 gpl, dowloaded 27-jan-2011 from libre of
act


in the output below, I'd like to se ' & DEF' as well on the first
row...


with Input_Sources.Strings; use Input_Sources.Strings;
with Sax.Readers;           use Sax.Readers;
with DOM.Readers;           use DOM.Readers;
with DOM.Core;              use DOM.Core;
with DOM.Core.Documents;    use DOM.Core.Documents;
with DOM.Core.Nodes;        use DOM.Core.Nodes;
with Ada.Text_IO;
with Unicode.CES.Basic_8bit;

procedure Test_Xml_Dom is
    Xml_Str : String := "<?xml version='1.0' encoding='ISO-8859-1'?
><env><Row>ABC &amp; &amp; DEF</Row><Row>ABC &amp;&amp; DEF</
Row><Row>ABC _ DEF</Row></env>";
    Input   : String_Input;
    Reader  : Tree_Reader;
    Doc     : Document;
    List    : Node_List;
    N       : Node;
begin
    Open(Xml_Str, Unicode.CES.Basic_8bit.Basic_8bit_Encoding,Input);
    Reader.Set_Feature(Validation_Feature, False);
    Reader.Set_Feature(Namespace_Feature, False);
    Reader.Parse(Input);
    Input.Close;
    Doc := Reader.Get_Tree;
    List := Get_Elements_By_Tag_Name(Doc, "Row");
    for Index in 1 .. Length (List) loop
      N := Item(List, Index - 1);
      Ada.Text_IO.Put_Line("Value of Row is: " &  Node_Value
(First_Child (N)));
    end loop;
end Test_Xml_Dom;

testrun:
c:\>test_xml_dom.exe
Value of Row is: ABC &
Value of Row is: ABC && DEF
Value of Row is: ABC _ DEF


/Björn



             reply	other threads:[~2011-01-27 10:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27 10:06 björn lundin [this message]
2011-01-27 11:12 ` xml/ada dropping data when pre-defined entities are separated by space? Georg Bauhaus
2011-01-29 15:36   ` björn lundin
2011-01-29 17:13     ` Simon Wright
2011-01-29 21:49       ` björn lundin
2011-01-29 22:24         ` Simon Wright
2011-01-31  0:22         ` Georg Bauhaus
2011-01-31  8:04           ` björn lundin
2011-01-31 14:56             ` Emmanuel Briot
2011-01-31 20:17               ` björn lundin
2011-02-01  9:49               ` björn lundin
2011-02-01 18:24                 ` Vadim Godunko
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox