Print

Print


Linda van den Brink <[log in to unmask]> writes:
>
> Is it correct that XML does not allow the underscore character in tag names?
> I tried to use elements like <standard_command> and <form_command>, but I
> get a parser error saying "character '_' not allowed in start tag" (or end
> tag).
>
> I assume that this would be defined in the XML declaration ("xml.dcl"?), but
> I don't know how to read this type of file. Is there a way that I can use
> the underscore in tag names, or is it just an illegal character for tag
> names.

Actually, XML does allow underscores as name characters, as noted in the
XML 1.0 specification for productions 4 and 5:

    Names and Tokens

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

Names must begin with a Letter, an underscore or colon, then any number
of name characters. According to the above grammar, you could even have
a '<_>' or '<:>' tag, which is unfortunate.

Sounds like your validation setup is not quite correct.

The SGML declaration for XML should also include an underscore character
in the NAMING section for LCNMCHAR and UCNMCHAR, if your XML validator
actually uses an SGML declaration.

Murray

...........................................................................
Murray Altheim, SGML Grease Monkey         <mailto:altheim&#64;eng.sun.com>
Member of Technical Staff, Tools Development & Support
Sun Microsystems, 901 San Antonio Rd., UMPK17-102, Palo Alto, CA 94303-4900

                       Not validated on animals.