Reputation: 87
I'm not sure if it's possible, but I need to form a element whose name begin with '[' and end with ']'. Something like this
<element_name>
<[name-with-brackets] atributte1="value" />
</element_name>
Is there any way to scape those brackets characters in name of the element. I know I can escape them in the value of an atributte o in the data of the elemente with
[ --> <Element_name atribute="[name-with-brackets]" />
In my sample:
<element_name>
<[name-with-brackets] atributte1="value" />
</element_name>
but it doesn't work with the element name
thanks
Upvotes: 1
Views: 1931
Reputation: 106443
Well, you can't do that, according to specs:
The first character of a Name MUST be a NameStartChar, and any other characters MUST be NameChars; this mechanism is used to prevent names from beginning with European (ASCII) digits or with basic combining characters.
NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6]
| [#xD8-#xF6] | [#xF8-#x2FF]
| [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D]
| [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF]
| [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7
| [#x0300-#x036F] | [#x203F-#x2040]
Document authors are encouraged to use names which are meaningful words or combinations of words in natural languages, and to avoid symbolic or white space characters in names. Note that COLON, HYPHEN-MINUS, FULL STOP (period), LOW LINE (underscore), and MIDDLE DOT are explicitly permitted.
Upvotes: 4