Henrik Tougaard wrote:
>
> > XML attributes can't contain "<" or "&" characters, or the
> > same quote that
> > they are surrounded by. The following are the encodings you can use
> > (and XMLSubsMatch needs to unravel):
> >
> > < => "<"
> > > => ">"
> > & => "&"
> > " => """
> > ' => "'"
> >
> > Note that only "<" is needed for your example (since encoding the
> > ">" isn't mandatory in XML generally).
> >
> Well this does limit the usefullness of the XMLSubs feature.
> I had hoped that it would be possbile to use any perl expression in
> the attributes - as an easy way of giving arguments to the perl-sub.
>
I think > is just about the only thing that you can't use as
a character in the attributes for an XMLSubs and that's because
it gets parsed with an aggressive ( or stupid ;) regexp like:
$$data =~ s|\<\s*($self->{xml_subs_match})([^\>]*)/\>
So basically what its doing is looking for everything up
to the first > so to put that in the data pretty well kills
it. The arguments are further evaluated from there as $2.
Its simple and fast, and would be really good to keep it
this way.
Note that XMLSubs attributes can be most valid perl expressions,
but I don't think > could be supported in this context either.
Another related XMLSubs attribute issue came up recently
where it was hard to quote the @ character because in perl
"some@email" will error usually, and the quick fix for this
is to have an argument with single quotes like email='some@email'
Internally an XMLSubs attribute will go from
<my:tag email='some@email' range=10 />
to something like
&my::tag(email => 'some@email', range => 10)
-- Joshua
_________________________________________________________________
Joshua Chamas Chamas Enterprises Inc.
NodeWorks >> free web link monitoring Huntington Beach, CA USA
http://www.nodeworks.com 1-714-625-4051