From 9d0f7d44d5cc5322415f52f7ce03cc37a478b350 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Wed, 28 Oct 2015 15:44:27 -0700 Subject: Implement AAPT Bundle format AAPT will scan XML files looking for the XML tag. The SINGLE child element of the tag is extracted into its own top level resource. It is given a generated name. The parent element of is then given the resource attribute that was assigned to the `name' attribute. The value is set to a reference to the generated resource. Bug:22627686 Change-Id: I31bc96aae30d38bfd0b16508d0f585de5fd88a07 --- tools/aapt/XMLNode.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tools/aapt/XMLNode.cpp') 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 >& XMLNode::getChildren() const return mChildren; } + +Vector >& 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) { -- cgit v1.2.3-59-g8ed1b