You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by Fredrick Paul Eisele <ph...@netarx.com> on 2001/03/13 15:48:40 UTC
The RTTI module
The RTTI module is our first cut at exposing a C++ capability into the Perl
environment.
RTTI, run time type information, implements serveral type/class functions.
dynamic_cast: can cast from a polymorphic base class to a derived or
sibling class. This is implemented as a restricted bless. I should not be
allowed to bless into a class for which certain methods will not be supported.
typeid: returns the class to which an object belongs, i.e. the ref function.
actual_cast: bless an object into the most specific class to which it belongs.
The relevance in Xerces is to provide a means for selectively blessing a
DOM::Node into, for example, the DOM::Element class, according to its
saved type. It happens that a DOM::Node carries its specific class, the
object is blessed into this class, upon calling actual_cast.
schema_cast: (in development) when an XML serialization is parsed it
would be nice if the resulting DOM were blessed into a class.
This could be implemented by reading a URN (namespace?), loading the
appropriate module and blessing the DOM into the package.
i.e. <xyz xmlns="urn:xerces:foo/bar"> would use XML::Xerces::foo::bar;
It is likely that introducing a module to perform these behaviors was ill
conceived and should be rethought. I frequently use the actual_cast method,
which could easily be added to the Xerces.pm without the need for any RTTI.pm.
--
Fredrick Paul Eisele
30910 Telegraph Rd.
Bingham Farms, MI
1.248.647.9800
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org