com.android.ide.common.res2
Class ValueXmlHelper

java.lang.Object
  extended by com.android.ide.common.res2.ValueXmlHelper

public class ValueXmlHelper
extends java.lang.Object

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 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

ValueXmlHelper

public ValueXmlHelper()
Method Detail

unescapeResourceString

@Nullable
public static java.lang.String unescapeResourceString(@Nullable
                                                               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.

Parameters:
s - the string to unescape
escapeEntities - XML entities
trim - whether surrounding space and quotes should be trimmed
Returns:
the string with the escape characters removed and expanded

escapeResourceString

public 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. Rules:

Parameters:
s - the string to be escaped
Returns:
the escaped string as it would appear in the XML text in a values file