Re: Attributes with dashes

Olaf Buwen <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.petal
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

from the specs:

http://w3c.org/TR/2004/REC-xml-20040204/#sec-common-syn

2.3 Common Syntactic Constructs
[Definition: A Name is a token beginning with a letter or one of a few
punctuation characters, and continuing with letters, digits, hyphens,
underscores, colons, or full stops, together known as name characters.]

Names beginning with the string "xml", or with any string which would
match (('X'|'x') ('M'|'m') ('L'|'l')), are reserved for standardization
in this or future versions of this specification.

...
[4]   	NameChar	   ::=   	Letter | Digit | '.' | '-' | '_' | ':' |
CombiningChar | Extender
[5]   	Name	   ::=   	(Letter | '_' | ':') (NameChar)*


IMHO, a full regexp to check attribute names is a little bit of
overkill; look for "B Character Classes" in the mentioned document to
see what I mean.

a regexp of the form (no production quality code, just a starting point!)
/([_:a-z][-_\.a-z0-9]*)/i
should be sufficient for most cases.

just my 2 cents



William McKee schrieb:
| On Tue, Jan 04, 2005 at 05:33:24PM +0000, Bruno Postle wrote:
|
|>Comments?  I'm no regular expression guru.
|
|
| I'm not regex pro either but I think trying to make Petal more closely
| work with the XML specs is worthwhile. Speaking of which, does anyone
| have a link to this spec?
|
|
| William
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB2vPVhbOUFKEaGaURAlrOAJ9yAXBtNAOIIQwwj5WXsrYE1W8v/QCgokol
PtN3vZaze8iFc3cGzAxq1nE=
=EoMx
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.