As shown in the title,I define a String using '&' in strings.xml file,but the android studio show a error? strings.xml
<string name="url">
url?locale=zh&articleNo=
</string>
Problems can be redefined:
We can't using special characters which have special meaning in XML.
The question is the XML syntax problems.
Use &
instead of just &
UPD:
Answer to "Why can't you use &" is: it is by design: http://www.w3.org/TR/xml/#charsets
The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they MUST be escaped using either numeric character references or the strings " & " and " < " respectively. The right angle bracket (>) may be represented using the string " > ", and MUST, for compatibility, be escaped using either " > " or a character reference when it appears in the string " ]]> " in content, when that string is not marking the end of a CDATA section.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With