The Android developer docs for string resources show an example string which is also a valid Java variable ("hello_world") which it explains is accessed via R.string.hello_world
My question is whether the XML is permitted to contain string name attributes that are invalid as Java variables. For example, are the following string keys allowed as XML resource names, and if so, how would they be accessed via R.string.<name>
in Java?
<string name="hello world" />
<string name="hello.world" />
<string name="42 hello world" />
Note to down-voters: I am not attempting to actually do this. I am attempting to understand what the file format allows and how the resources are converted.
Some context for what and why I'm asking:
My software converts key/value pairs to XML resources and automatically converts all keys to valid Java variables, so "hello-world" is converted to "hello_world". However a user reported that they wanted to keep "hello.world" as the value of XML name attribute. They informed me that the Android builder would convert it to "hello_world". So I am asking this question to work out which cases I should automatically handle and which I should allow through.
<string name="..">
I incorrectly typed "key" in my question, which I've now fixed – Tim