diff options
author | Yue Gan <yueg@google.com> | 2016-06-13 09:58:03 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2016-06-13 11:20:15 +0000 |
commit | 5160d196e62bf6f8fa56b32746a01b182729c5c8 (patch) | |
tree | bce2a225d4417a92a4745e96fb1b0a2fc7c704ac /src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java | |
parent | 8d23e6061ce110971d75f7a15015a60d6e49a4d4 (diff) |
Rollback of commit 4f854d47888d011354357e965fd3c7bf1d74b95f.
*** Reason for rollback ***
Breakage: http://ci.bazel.io/view/Bazel%20bootstrap%20and%20maintenance/job/Bazel/601/
*** Original change description ***
Xml processing fixes:
* Support for <item name="foo" type="id">7x0000</item>
* Adds <eat-comment/> after source attributions to ensure they are not sent to the final binary
* Store attributes for arrays to the string translatable=false case
--
MOS_MIGRATED_REVID=124708349
Diffstat (limited to 'src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java b/src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java index 8f4978e571..9267e97d93 100644 --- a/src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java +++ b/src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java @@ -165,22 +165,6 @@ public class XmlResourceValues { static XmlResourceValue parseSimple( XMLEventReader eventReader, ResourceType resourceType, StartElement start) throws XMLStreamException { - String contents; - // Check that the element is unary. If it is, the contents is null - if (isEndTag(eventReader.peek(), start.getName())) { - contents = null; - } else { - contents = readContentsAsString(eventReader, start.getName()); - } - return SimpleXmlResourceValue.of( - start.getName().equals(TAG_ITEM) - ? SimpleXmlResourceValue.Type.ITEM - : SimpleXmlResourceValue.Type.from(resourceType), - ImmutableMap.copyOf(parseTagAttributes(start)), - contents); - } - - public static Map<String, String> parseTagAttributes(StartElement start) { // Using a map to deduplicate xmlns declarations on the attributes. Map<String, String> attributeMap = new LinkedHashMap<>(); Iterator<Attribute> attributes = iterateAttributesFrom(start); @@ -206,7 +190,19 @@ public class XmlResourceValues { attributeMap.put(attribute.getName().getLocalPart(), value); } } - return attributeMap; + String contents; + // Check and see if the element is unary. If it is, the contents is null + if (isEndTag(eventReader.peek(), start.getName())) { + contents = null; + } else { + contents = readContentsAsString(eventReader, start.getName()); + } + return SimpleXmlResourceValue.of( + start.getName().equals(TAG_ITEM) + ? SimpleXmlResourceValue.Type.ITEM + : SimpleXmlResourceValue.Type.from(resourceType), + ImmutableMap.copyOf(attributeMap), + contents); } // TODO(corysmith): Replace this with real escaping system, preferably a performant high level xml |