[Petal] Attributes with dashes
Bruno Postle
bruno at mkdoc.com
Tue Jan 4 17:33:24 GMT 2005
On Tue 04-Jan-2005 at 15:55 +0100, Olaf Buwen wrote:
>
> "tal:attributes='foo-bar data/foo/bar'" does not work, although XML
> allows attributes with dashes.
>
> As a workaround, I modified the regular expression in
> Petal/Canonicalizer/XML.pm, line 547 from
> /^\s*((?:\w|\:)+)\s+(.*?)\s*$/
> to
> /^\s*((?:[-\w]|\:)+)\s+(.*?)\s*$/
It would be nice if either regex matched the XML specification for
attribute names. Petal could generate attributes like these which
I'm sure are not within the XML spec:
-foo="whatever"
--bar="whatever"
This might also cause trouble with the "--value" system for passing
arguments to methods.
Also I think this is a valid XML attribute:
foo_2.BAR="whatever"
So the regex needs to look something like this:
/^\s*([A-Za-z_:][A-Za-z0-9_:.-]*)\s+(.*?)\s*$/
Comments? I'm no regular expression guru.
--
Bruno
More information about the Petal
mailing list