Re: XML::Rules tagspec
Terrence Brannon <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
Jenda Krynicky wrote:
>> 2 - but anyway I'm wondering why you cant select tags based on
>> attributes of the tag. And also why you cant provide a subref here that
>> returns true for tags matching its tests. In others,
>> HTML::Element::look_down can find tags by 'tagspec', but it can also
>> easily do various attribute tests and if that's not enough, use a sub ref.
>>
>> The reason I mention it, is that you could have two table tags in a
>> document and have different rules for processing each:
>>
>> sub my_table_1 {
>> $self->gi eq 'table' and $self->attr('table_number') == 1
>> }
>>
>> my $tagspec = \&my_table_1
>>
>
> I would like to keep it simple.
This rules out XML::Rules for things like: "eliminate all sections
marked with attribute "klass" whose value is 12.
Processing XML (or in my case, XHTML) is not always based on the gi.
Whereas with treebuilder, I can do
my @node = $tree->look_down(klass => 12);
$_->delete for @node;
if-then is my last resort for complexity management.
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs