|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.android.ide.common.res2.ValueXmlHelper
public class ValueXmlHelper
Helper class to help with XML values resource file.
Constructor Summary | |
---|---|
ValueXmlHelper()
|
Method Summary | |
---|---|
static java.lang.String |
escapeResourceString(java.lang.String s)
Escape a string value to be placed in a string resource file such that it complies with the escaping rules described here: http://developer.android.com/guide/topics/resources/string-resource.html More examples of the escaping rules can be found here: http://androidcookbook.com/Recipe.seam?recipeId=2219&recipeFrom=ViewTOC This method assumes that the String is not escaped already. |
static java.lang.String |
escapeResourceString(java.lang.String s,
boolean escapeXml)
Escape a string value to be placed in a string resource file such that it complies with the escaping rules described here: http://developer.android.com/guide/topics/resources/string-resource.html More examples of the escaping rules can be found here: http://androidcookbook.com/Recipe.seam?recipeId=2219&recipeFrom=ViewTOC This method assumes that the String is not escaped already. |
static java.lang.String |
unescapeResourceString(java.lang.String s,
boolean escapeEntities,
boolean trim)
Replaces escapes in an XML resource string with the actual characters, performing unicode substitutions (replacing any \\uNNNN references in the
given string with the corresponding unicode characters), etc. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ValueXmlHelper()
Method Detail |
---|
@Nullable public static java.lang.String unescapeResourceString(@Nullable java.lang.String s, boolean escapeEntities, boolean trim)
\\uNNNN
references in the
given string with the corresponding unicode characters), etc.
s
- the string to unescapeescapeEntities
- XML entitiestrim
- whether surrounding space and quotes should be trimmed
public static java.lang.String escapeResourceString(java.lang.String s)
@, ?
at beginning of string have to be escaped with a backslash.
', ", \
have to be escaped with a backslash.
<, >, &
have to be replaced by their predefined xml entity.
\n, \t
have to be replaced by a backslash and the appropriate character.
s
- the string to be escaped
public static java.lang.String escapeResourceString(java.lang.String s, boolean escapeXml)
@, ?
at beginning of string have to be escaped with a backslash.
', ", \
have to be escaped with a backslash.
<, >, &
have to be replaced by their predefined xml entity.
\n, \t
have to be replaced by a backslash and the appropriate character.
s
- the string to be escapedescapeXml
- whether XML characters like <
and &
should be
escaped; this should normally be true, but is optional since
some callers need to pass the string over to code which already escapes
XML content, and you wouldn't want the ampersand in the escaped character
entity to itself be escaped.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |