summaryrefslogtreecommitdiff
path: root/tools/aapt/XMLNode.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2015-10-28 15:44:27 -0700
committerAdam Lesinski <adamlesinski@google.com>2015-11-30 14:43:43 -0800
commit07dfd2d8642f8a3630ca6429f740865a0c0bfdf7 (patch)
tree28a4aa59b021ddbf0f7bcf9890c98994fd16ade8 /tools/aapt/XMLNode.cpp
parent14ed6cf3e7bada4932314969000d384bed6d3f92 (diff)
Implement AAPT Bundle format
AAPT will scan XML files looking for the <aapt:attr> XML tag. <!-- @layout/bundle.xml --> <ImageView xmlns:aapt="http://schemas.android.com/aapt"> <aapt:attr name="android:src"> <vector android:pathData="..." ...> </vector> </aapt:attr> </ImageView> The SINGLE child element of the <aapt:attr> tag is extracted into its own top level resource. It is given a generated name. The parent element of <aapt:attr> is then given the resource attribute that was assigned to the `name' attribute. The value is set to a reference to the generated resource. <!-- @layout/bundle.xml --> <ImageView android:src="@drawable/bundle_1.xml"> </ImageView> <!-- @layout/bundle_1.xml --> <vector android:pathData="..." ...> </vector> Bug:22627686 Change-Id: I8575fc4f739011402662fbf6b3db96df0012f598
Diffstat (limited to 'tools/aapt/XMLNode.cpp')
-rw-r--r--tools/aapt/XMLNode.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index dc08eb806356..5b215daeb494 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -693,6 +693,12 @@ const Vector<sp<XMLNode> >& XMLNode::getChildren() const
return mChildren;
}
+
+Vector<sp<XMLNode> >& XMLNode::getChildren()
+{
+ return mChildren;
+}
+
const String8& XMLNode::getFilename() const
{
return mFilename;
@@ -717,6 +723,18 @@ const XMLNode::attribute_entry* XMLNode::getAttribute(const String16& ns,
return NULL;
}
+bool XMLNode::removeAttribute(const String16& ns, const String16& name)
+{
+ for (size_t i = 0; i < mAttributes.size(); i++) {
+ const attribute_entry& ae(mAttributes.itemAt(i));
+ if (ae.ns == ns && ae.name == name) {
+ removeAttribute(i);
+ return true;
+ }
+ }
+ return false;
+}
+
XMLNode::attribute_entry* XMLNode::editAttribute(const String16& ns,
const String16& name)
{