[Javascript] regexp
Nick Fitzsimons
nick at nickfitz.co.uk
Tue Apr 25 12:51:34 CDT 2006
Steve Clay wrote:
> Tuesday, April 25, 2006, 12:00:29 PM, Nick Fitzsimons wrote:
>
>>Unfortunately word boundaries can occur within classNames, as they
>>include hyphens, meaning the above would incorrectly find a match on
>>class="highlighted-blob"
>
>
> Oops, I just ran into that a few days ago parsing markup (attributes can
> have hyphens).
>
> What are the (or where can I find definitive lists of) allowable chars in
> the names of XML elements and attributes, and XHTML ids and classes?
>
> Steve
As far as HTML is concerned, there's a summary of the formal SGML
definition in the HTML 4.01 spec at:
<http://www.w3.org/TR/html4/types.html#h-6.2>
The DTD defines "id" as of type ID and "class" as of type CDATA.
As for XML, "id" is in the XML 1.0 spec(3rd edition) at
<http://www.w3.org/TR/2004/REC-xml-20040204/#id>
and you can follow the links from there for Name and NameChar, which
should allow you to see what's permitted.
HTH,
Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/
More information about the Javascript
mailing list