Lines Matching refs:xml

20 #include "xml/XmlActionExecutor.h"
21 #include "xml/XmlDom.h"
26 * This is how PackageManager builds class names from AndroidManifest.xml entries.
28 static bool nameIsJavaClassName(xml::Element* el, xml::Attribute* attr,
54 static bool optionalNameIsJavaClassName(xml::Element* el, SourcePathDiagnostics* diag) {
55 if (xml::Attribute* attr = el->findAttribute(xml::kSchemaAndroid, u"name")) {
61 static bool requiredNameIsJavaClassName(xml::Element* el, SourcePathDiagnostics* diag) {
62 if (xml::Attribute* attr = el->findAttribute(xml::kSchemaAndroid, u"name")) {
70 static bool verifyManifest(xml::Element* el, SourcePathDiagnostics* diag) {
71 xml::Attribute* attr = el->findAttribute({}, u"package");
88 bool ManifestFixer::buildRules(xml::XmlActionExecutor* executor, IDiagnostics* diag) {
107 xml::XmlNodeAction intentFilterAction;
113 xml::XmlNodeAction metaDataAction;
116 xml::XmlNodeAction& manifestAction = (*executor)[u"manifest"];
118 manifestAction.action([&](xml::Element* el) -> bool {
120 if (el->findAttribute(xml::kSchemaAndroid, u"versionName") == nullptr) {
121 el->attributes.push_back(xml::Attribute{
122 xml::kSchemaAndroid,
129 if (el->findAttribute(xml::kSchemaAndroid, u"versionCode") == nullptr) {
130 el->attributes.push_back(xml::Attribute{
131 xml::kSchemaAndroid,
143 manifestAction[u"uses-sdk"].action([&](xml::Element* el) -> bool {
145 el->findAttribute(xml::kSchemaAndroid, u"minSdkVersion") == nullptr) {
147 el->attributes.push_back(xml::Attribute{
148 xml::kSchemaAndroid, u"minSdkVersion",
153 el->findAttribute(xml::kSchemaAndroid, u"targetSdkVersion") == nullptr) {
155 el->attributes.push_back(xml::Attribute{
156 xml::kSchemaAndroid, u"targetSdkVersion",
163 manifestAction[u"instrumentation"].action([&](xml::Element* el) -> bool {
168 if (xml::Attribute* attr = el->findAttribute(xml::kSchemaAndroid, u"targetPackage")) {
189 xml::XmlNodeAction& applicationAction = (*executor)[u"manifest"][u"application"];
219 class FullyQualifiedClassNameVisitor : public xml::Visitor {
221 using xml::Visitor::visit;
226 void visit(xml::Element* el) override {
227 for (xml::Attribute& attr : el->attributes) {
235 xml::Visitor::visit(el);
242 static bool renameManifestPackage(const StringPiece16& packageOverride, xml::Element* manifestEl) {
243 xml::Attribute* attr = manifestEl->findAttribute({}, u"package");
256 bool ManifestFixer::consume(IAaptContext* context, xml::XmlResource* doc) {
257 xml::Element* root = xml::findRootElement(doc->root.get());
267 std::unique_ptr<xml::Element> usesSdk = util::make_unique<xml::Element>();
272 xml::XmlActionExecutor executor;
277 if (!executor.execute(xml::XmlActionExecutorPolicy::Whitelist, context->getDiagnostics(),