comp.lang.ada
 help / color / mirror / Atom feed
From: "chris.danx" <spamoff.danx@ntlworld.com>
Subject: OO, DOM & XML/Ada
Date: Wed, 26 Mar 2003 23:24:04 +0000
Date: 2003-03-26T23:24:04+00:00	[thread overview]
Message-ID: <cEqga.943$8s6.9942@newsfep4-glfd.server.ntli.net> (raw)

Hi,


I've been trying to implement an OO DOM and I think I know why the 
authors of XML/Ada did it with variant records instead of OO.  It's a 
wee bit difficult to implement.  Firstly, nodes have to be updatable and 
changes must be 'live' ("changes to the underlying document structure 
are reflected in all relevant NodeList and NamedNodeMap objects" 
according to the spec).

Secondly, "Node" contains a "Document" which is a decendant of Node.  I 
can sortof handle both of the issues, but it does require a little bit 
of indirection and quite a few pointers.  I'm wondering if there's a 
better way, or if an OO DOM is really necessary.  Thoughts are 
appreciated.


This is the current state of affairs...

package Dom.Core.Nodes is

    type Node is tagged private;
    type Node_Access is access all Node'class;

...

private
    type Node_Rep;
    type Node_Rep_Access is access Node_Rep;

    type Node_Rep is record
       Name        : Dom_String_Access;
       Value       : Dom_String_Access;

       Kind        : Node_Type;
       Par         : Node_Access;
       prevSib     : Node_Access;
       NextSib     : Node_Access;

       Doc         : Node_Access;

       -- TBC

    end record;

    type Node is tagged record
       underlying : Node_Rep_Access;
    end record;

    ...

end Dom.Core.Nodes;




             reply	other threads:[~2003-03-26 23:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-26 23:24 chris.danx [this message]
2003-03-26 23:25 ` OO, DOM & XML/Ada chris.danx
replies disabled

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