ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
Re: Subclassing XML::LibXML::Document
by D. Hageman other posts by this author
Sep 5 2002 3:02AM messages near this date
view in the new Beta List Site
Subclassing XML::LibXML::Document | Re: XML::SAX::Expat - can't stop parsing
It just won't work like that ... your best bet is wrapping it using a 
similar scheme like I used in the TEI::Lite module.  It gives the 
appearance of subclassing with the ability to keep adding functionality.  

Well, I could be wrong ... it wouldn't be a bad thing.  If so, I would 
really like to subclass XML::LibXML::Element/Node.

On Wed, 4 Sep 2002, Calbazana, Al wrote:

>  Hello,
>   
>  I'd like to subclass XML::LibXML::Document in order to assist with creation
>  of  XML documents (I want to ease XML creation and have all the facilities
>  of a DOM).  Additionally, I'd like my subclass of XML::LibXML::Document to
>  be an "event notifiier".  So when nodes are added or modified, e.g. - the
>  subclass' state has changed,  I'd like it to be able to fire off events to
>  listeners.
>   
>  I can subclass Document just fine... The problem I am having is that I can
>  not work with XML::LibXML::Document since it seems to be a scalar ref and
>  not a hash ref.  When I try to add additional properties to it, it fails
>  with (Not a HASH reference...).  Is there any way around this?  I'd like to
>  subclass rather than wrap a Document.
>   
>  My constructor goes something like:
>   
>  Our @ISA = qw{XML::LibXML::Document);
>   
>  Sub new{
>              My $class = shift;
>              My $self = $class->SUPER::new('1.0','UTF8');     
>  Bless $self, $class;
>   
>  $self->{'Listeners'} = []; # fails!
>  Return $self,
>  }
>   
>  Thanks!
>   
>  Al
>  
>  
>  **********************************************************************
>  This email and any files transmitted with it are confidential and
>  intended solely for the use of the individual or entity to whom they
>  are addressed. If you have received this email in error please notify
>  the system manager.
>  
>  This footnote also confirms that this email message has been swept by
>  MIMEsweeper for the presence of computer viruses.
>  
>  www.mimesweeper.com
>  **********************************************************************
>  
>  

-- 
//========================================================\||  D. Hageman                   
 <dhageman@[...].com>   ||
\\========================================================//

_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Calbazana, Al
D. Hageman

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved