comp.lang.ada
 help / color / mirror / Atom feed
* OO, DOM & XML/Ada
@ 2003-03-26 23:24 chris.danx
  2003-03-26 23:25 ` chris.danx
  0 siblings, 1 reply; 2+ messages in thread
From: chris.danx @ 2003-03-26 23:24 UTC (permalink / 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;




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: OO, DOM & XML/Ada
  2003-03-26 23:24 OO, DOM & XML/Ada chris.danx
@ 2003-03-26 23:25 ` chris.danx
  0 siblings, 0 replies; 2+ messages in thread
From: chris.danx @ 2003-03-26 23:25 UTC (permalink / raw)


chris.danx wrote:

> 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.
                                           ^

Sorry that should read "benefitial/desirable"




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-26 23:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-26 23:24 OO, DOM & XML/Ada chris.danx
2003-03-26 23:25 ` chris.danx

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