Add namespace handling in attribute values
Previously, you could only reference namespace prefixes in attribute names:
<View xmlns:appcompat="http://schemas.android.com/apk/res/android.support.v7.appcompat"
appcompat:name="hey"
...
Now you can also reference them in resource names within an attribute value:
...
android:text="@appcompat:string/confirm"
...
Which will be treated as "@android.support.v7.appcompat:string/confirm".
Change-Id: Ib076e867a990c80cf877a704eb77cd1ef0b23b52
diff --git a/tools/aapt2/XmlPullParser.h b/tools/aapt2/XmlPullParser.h
index 753405c..accfd30a 100644
--- a/tools/aapt2/XmlPullParser.h
+++ b/tools/aapt2/XmlPullParser.h
@@ -72,16 +72,27 @@
*/
virtual const std::u16string& getText() const = 0;
- /**
- * Namespace prefix is available for StartNamespace and EndNamespace.
- */
- virtual const std::u16string& getNamespacePrefix() const = 0;
+ //
+ // Namespace prefix and URI are available for StartNamespace and EndNamespace.
+ //
- /**
- * Namespace URI is available for StartNamespace.
- */
+ virtual const std::u16string& getNamespacePrefix() const = 0;
virtual const std::u16string& getNamespaceUri() const = 0;
+ /*
+ * Uses the current stack of namespaces to resolve the package. Eg:
+ * xmlns:app = "http://schemas.android.com/apk/res/com.android.app"
+ * ...
+ * android:text="@app:string/message"
+ *
+ * In this case, 'app' will be converted to 'com.android.app'.
+ *
+ * If xmlns:app="http://schemas.android.com/apk/res-auto", then
+ * 'package' will be set to 'defaultPackage'.
+ */
+ virtual bool applyPackageAlias(std::u16string* package,
+ const std::u16string& defaultPackage) const = 0;
+
//
// These are available for StartElement and EndElement.
//