summaryrefslogtreecommitdiff
path: root/tools/aapt2/configuration/ConfigurationParser.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-08-09 10:54:23 -0700
committerAdam Lesinski <adamlesinski@google.com>2017-08-17 17:43:08 +0000
commit6b372991296c9f2bd6f8f8847dcd23d50970d06d (patch)
tree325fa6d275390fd3d0d9757545f128fbe9ed39f9 /tools/aapt2/configuration/ConfigurationParser.cpp
parentc10cc1185b0024a12660f4de7fbb6ad78bd1cfb7 (diff)
AAPT2: Change XmlDom to exclude Namespace as a node
In preparation for exporting an XML proto format for UAM to consume, this change brings the XML DOM API more in line with other APIs that do not make the Namespace a separate node. Treating Namespace declarations as just properties of an Element node makes the implementation of algorithms much simpler, as the constraints that Namespace nodes have only one child are now built in and traversing to find Element nodes is much simpler. Also made a bunch of quality of life improvements, like formatting and comment style. Test: make aapt2_tests Change-Id: Ib97ff1c4252b7907e2cc1f13a448dc4ca3b809a4
Diffstat (limited to 'tools/aapt2/configuration/ConfigurationParser.cpp')
-rw-r--r--tools/aapt2/configuration/ConfigurationParser.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/aapt2/configuration/ConfigurationParser.cpp b/tools/aapt2/configuration/ConfigurationParser.cpp
index b0ed792215df..7ab690ce5789 100644
--- a/tools/aapt2/configuration/ConfigurationParser.cpp
+++ b/tools/aapt2/configuration/ConfigurationParser.cpp
@@ -53,7 +53,6 @@ using ::aapt::io::RegularFile;
using ::aapt::io::StringInputStream;
using ::aapt::util::TrimWhitespace;
using ::aapt::xml::Element;
-using ::aapt::xml::FindRootElement;
using ::aapt::xml::NodeCast;
using ::aapt::xml::XmlActionExecutor;
using ::aapt::xml::XmlActionExecutorPolicy;
@@ -197,13 +196,13 @@ ConfigurationParser::ConfigurationParser(std::string contents)
Maybe<PostProcessingConfiguration> ConfigurationParser::Parse() {
StringInputStream in(contents_);
- auto doc = xml::Inflate(&in, diag_, Source("config.xml"));
+ std::unique_ptr<xml::XmlResource> doc = xml::Inflate(&in, diag_, Source("config.xml"));
if (!doc) {
return {};
}
// Strip any namespaces from the XML as the XmlActionExecutor ignores anything with a namespace.
- auto* root = FindRootElement(doc.get());
+ Element* root = doc->root.get();
if (root == nullptr) {
diag_->Error(DiagMessage() << "Could not find the root element in the XML document");
return {};