in reply to Re: XML::TokeParser::Simple - pretty much like HTML::TokeParser::Simple
in thread XML::TokeParser::Simple - pretty much like HTML::TokeParser::Simple
D'oh.
I mean, why would you get_tag and then test to see if it's a tag, or a process instruction, since it can only be a tag.
I quickly fixed this and then I got reminded again that a XML::TokeParser::Token doesn't have a constructor -- yuck.
Then I thought maybe I should force get_tag to return a proper token, but that would break backwards compatiblity, and I sure don't wanna do that.
Then I think to myself I should forget all this nonsense, and have
Thoughts/Comments? I think maybe that's what i'll do, becausepackage XML::TokeParser::Token; sub is_text { return 0; } sub is_comment { return 0; } sub is_pi { return 0; } sub is_tag { return 0; } sub is_start_tag { return 0; } sub is_end_tag { return 0; } sub raw { return $_[0]->[-1]; } package XML::TokeParser::Token::Text; # use vars::i '@ISA' => 'XML::TokeParser::Token'; # i'll probably put +vars::i on cpan also use vars '@ISA'; @ISA = 'XML::TokeParser::Token'; sub is_text { return 1; } sub text { return $_[0]->[-2]; }
does not look so hot. *sigh*sub is_end_tag { if( $_[0]->[0] eq 'E' or ( @{$_[0]} == 2 && substr( $_[0]->[0], 0, 1 ) eq '/' ) ){ if(defined $_[1]){ return 1 if $_[0]->[1] eq $_[1]; } else { return 1; } } return 0; }
|
MJD says you can't just make shit up and expect the computer to know what you mean, retardo! I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests. ** The Third rule of perl club is a statement of fact: pod is sexy. |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: XML::TokeParser::Simple - pretty much like HTML::TokeParser::Simple
by Ovid (Cardinal) on Jun 10, 2003 at 04:58 UTC |