]> git.saurik.com Git - android/aapt.git/commitdiff
reconcile donut snapshot
authorJean-Baptiste Queru <jbq@google.com>
Wed, 20 May 2009 18:28:11 +0000 (11:28 -0700)
committerJean-Baptiste Queru <jbq@google.com>
Wed, 20 May 2009 18:28:11 +0000 (11:28 -0700)
Merge branch 'donut-snapshot' into HEAD

Bundle.h
Command.cpp
Main.cpp
Resource.cpp
ResourceTable.cpp
ResourceTable.h
XMLNode.cpp
XMLNode.h

index 2d8471bb5cc64f686594983c0cd06f327c218657..2eb7a1ddda9afef5acb75dd2420a8ca83da4a341 100644 (file)
--- a/Bundle.h
+++ b/Bundle.h
@@ -38,6 +38,8 @@ public:
           mAssetSourceDir(NULL),
           mAndroidManifestFile(NULL), mPublicOutputFile(NULL),
           mRClassDir(NULL), mResourceIntermediatesDir(NULL),
+          mMinSdkVersion(NULL), mTargetSdkVersion(NULL), mMaxSdkVersion(NULL),
+          mVersionCode(NULL), mVersionName(NULL),
           mArgc(0), mArgv(NULL)
         {}
     ~Bundle(void) {}
@@ -99,6 +101,17 @@ public:
     const android::Vector<const char*>& getNoCompressExtensions() const { return mNoCompressExtensions; }
     void addNoCompressExtension(const char* ext) { mNoCompressExtensions.add(ext); }
 
+    const char*  getMinSdkVersion() const { return mMinSdkVersion; }
+    void setMinSdkVersion(const char*  val) { mMinSdkVersion = val; }
+    const char*  getTargetSdkVersion() const { return mTargetSdkVersion; }
+    void setTargetSdkVersion(const char*  val) { mTargetSdkVersion = val; }
+    const char*  getMaxSdkVersion() const { return mMaxSdkVersion; }
+    void setMaxSdkVersion(const char*  val) { mMaxSdkVersion = val; }
+    const char*  getVersionCode() const { return mVersionCode; }
+    void setVersionCode(const char*  val) { mVersionCode = val; }
+    const char* getVersionName() const { return mVersionName; }
+    void setVersionName(const char* val) { mVersionName = val; }
+    
     /*
      * Set and get the file specification.
      *
@@ -151,6 +164,12 @@ private:
     android::Vector<const char*> mNoCompressExtensions;
     android::Vector<const char*> mResourceSourceDirs;
     
+    const char* mMinSdkVersion;
+    const char* mTargetSdkVersion;
+    const char* mMaxSdkVersion;
+    const char* mVersionCode;
+    const char* mVersionName;
+    
     /* file specification */
     int         mArgc;
     char* const* mArgv;
index 6f3461df15eb1b4fd76d00597b79d454e8c4accc..dc91a48ce24e1eb76149aef578d6e9ec5e8665f4 100644 (file)
@@ -268,17 +268,19 @@ static String8 getAttribute(const ResXMLTree& tree, uint32_t attrRes, String8* o
     return str ? String8(str, len) : String8();
 }
 
-static int32_t getIntegerAttribute(const ResXMLTree& tree, uint32_t attrRes, String8* outError)
+static int32_t getIntegerAttribute(const ResXMLTree& tree, uint32_t attrRes,
+        String8* outError, int32_t defValue = -1)
 {
     ssize_t idx = indexOfAttribute(tree, attrRes);
     if (idx < 0) {
-        return -1;
+        return defValue;
     }
     Res_value value;
     if (tree.getAttributeValue(idx, &value) != NO_ERROR) {
-        if (value.dataType != Res_value::TYPE_INT_DEC) {
+        if (value.dataType < Res_value::TYPE_FIRST_INT
+                || value.dataType > Res_value::TYPE_LAST_INT) {
             if (outError != NULL) *outError = "attribute is not an integer value";
-            return -1;
+            return defValue;
         }
     }
     return value.data;
@@ -318,7 +320,15 @@ enum {
     VERSION_NAME_ATTR = 0x0101021c,
     LABEL_ATTR = 0x01010001,
     ICON_ATTR = 0x01010002,
-    MIN_SDK_VERSION_ATTR = 0x0101020c
+    MIN_SDK_VERSION_ATTR = 0x0101020c,
+    REQ_TOUCH_SCREEN_ATTR = 0x01010227,
+    REQ_KEYBOARD_TYPE_ATTR = 0x01010228,
+    REQ_HARD_KEYBOARD_ATTR = 0x01010229,
+    REQ_NAVIGATION_ATTR = 0x0101022a,
+    REQ_FIVE_WAY_NAV_ATTR = 0x01010232,
+    TARGET_SDK_VERSION_ATTR = 0x01010270,
+    TEST_ONLY_ATTR = 0x01010272,
+    DENSITY_ATTR = 0x0101026c,
 };
 
 const char *getComponentName(String8 &pkgName, String8 &componentName) {
@@ -357,7 +367,8 @@ int doDump(Bundle* bundle)
     const char* filename = bundle->getFileSpecEntry(1);
 
     AssetManager assets;
-    if (!assets.addAssetPath(String8(filename), NULL)) {
+    void* assetsCookie;
+    if (!assets.addAssetPath(String8(filename), &assetsCookie)) {
         fprintf(stderr, "ERROR: dump failed because assets could not be loaded\n");
         return 1;
     }
@@ -543,15 +554,77 @@ int doDump(Bundle* bundle)
                             goto bail;
                         }
                         printf("icon='%s'\n", icon.string());
-                    } else if (tag == "uses-sdk") {
-                        int32_t sdkVersion = getIntegerAttribute(tree, MIN_SDK_VERSION_ATTR, &error);
+                        int32_t testOnly = getIntegerAttribute(tree, TEST_ONLY_ATTR, &error, 0);
                         if (error != "") {
-                            fprintf(stderr, "ERROR getting 'android:minSdkVersion' attribute: %s\n", error.string());
+                            fprintf(stderr, "ERROR getting 'android:testOnly' attribute: %s\n", error.string());
                             goto bail;
                         }
-                        if (sdkVersion != -1) {
-                            printf("sdkVersion:'%d'\n", sdkVersion);
+                        if (testOnly != 0) {
+                            printf("testOnly='%d'\n", testOnly);
+                        }
+                    } else if (tag == "uses-sdk") {
+                        int32_t code = getIntegerAttribute(tree, MIN_SDK_VERSION_ATTR, &error);
+                        if (error != "") {
+                            error = "";
+                            String8 name = getResolvedAttribute(&res, tree, MIN_SDK_VERSION_ATTR, &error);
+                            if (error != "") {
+                                fprintf(stderr, "ERROR getting 'android:minSdkVersion' attribute: %s\n",
+                                        error.string());
+                                goto bail;
+                            }
+                            printf("sdkVersion:'%s'\n", name.string());
+                        } else if (code != -1) {
+                            printf("sdkVersion:'%d'\n", code);
+                        }
+                        code = getIntegerAttribute(tree, TARGET_SDK_VERSION_ATTR, &error);
+                        if (error != "") {
+                            error = "";
+                            String8 name = getResolvedAttribute(&res, tree, TARGET_SDK_VERSION_ATTR, &error);
+                            if (error != "") {
+                                fprintf(stderr, "ERROR getting 'android:targetSdkVersion' attribute: %s\n",
+                                        error.string());
+                                goto bail;
+                            }
+                            printf("targetSdkVersion:'%s'\n", name.string());
+                        } else if (code != -1) {
+                            printf("targetSdkVersion:'%d'\n", code);
+                        }
+                    } else if (tag == "uses-configuration") {
+                        int32_t reqTouchScreen = getIntegerAttribute(tree,
+                                REQ_TOUCH_SCREEN_ATTR, NULL, 0);
+                        int32_t reqKeyboardType = getIntegerAttribute(tree,
+                                REQ_KEYBOARD_TYPE_ATTR, NULL, 0);
+                        int32_t reqHardKeyboard = getIntegerAttribute(tree,
+                                REQ_HARD_KEYBOARD_ATTR, NULL, 0);
+                        int32_t reqNavigation = getIntegerAttribute(tree,
+                                REQ_NAVIGATION_ATTR, NULL, 0);
+                        int32_t reqFiveWayNav = getIntegerAttribute(tree,
+                                REQ_FIVE_WAY_NAV_ATTR, NULL, 0);
+                        printf("uses-configuation:");
+                        if (reqTouchScreen != 0) {
+                            printf(" reqTouchScreen='%d'", reqTouchScreen);
+                        }
+                        if (reqKeyboardType != 0) {
+                            printf(" reqKeyboardType='%d'", reqKeyboardType);
+                        }
+                        if (reqHardKeyboard != 0) {
+                            printf(" reqHardKeyboard='%d'", reqHardKeyboard);
+                        }
+                        if (reqNavigation != 0) {
+                            printf(" reqNavigation='%d'", reqNavigation);
                         }
+                        if (reqFiveWayNav != 0) {
+                            printf(" reqFiveWayNav='%d'", reqFiveWayNav);
+                        }
+                        printf("\n");
+                    } else if (tag == "supports-density") {
+                        int32_t dens = getIntegerAttribute(tree, DENSITY_ATTR, &error);
+                        if (error != "") {
+                            fprintf(stderr, "ERROR getting 'android:density' attribute: %s\n",
+                                    error.string());
+                            goto bail;
+                        }
+                        printf("supports-density:'%d'\n", dens);
                     }
                 } else if (depth == 3 && withinApplication) {
                     withinActivity = false;
@@ -592,18 +665,18 @@ int doDump(Bundle* bundle)
                         }
                     }
                 } else if (depth == 5) {
-                        if (withinActivity) {
-                            if (tag == "action") {
-                                //printf("LOG: action tag\n");
-                                String8 action = getAttribute(tree, NAME_ATTR, &error);
-                                if (error != "") {
-                                    fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n", error.string());
-                                    goto bail;
-                                }
-                                if (action == "android.intent.action.MAIN") {
-                                    isMainActivity = true;
-                                    //printf("LOG: isMainActivity==true\n");
-                                }
+                    if (withinActivity) {
+                        if (tag == "action") {
+                            //printf("LOG: action tag\n");
+                            String8 action = getAttribute(tree, NAME_ATTR, &error);
+                            if (error != "") {
+                                fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n", error.string());
+                                goto bail;
+                            }
+                            if (action == "android.intent.action.MAIN") {
+                                isMainActivity = true;
+                                //printf("LOG: isMainActivity==true\n");
+                            }
                         } else if (tag == "category") {
                             String8 category = getAttribute(tree, NAME_ATTR, &error);
                             if (error != "") {
@@ -671,6 +744,17 @@ int doDump(Bundle* bundle)
                 printf(" '%s'", localeStr);
             }
             printf("\n");
+            AssetDir* dir = assets.openNonAssetDir(assetsCookie, "lib");
+            if (dir != NULL) {
+                if (dir->getFileCount() > 0) {
+                    printf("native-code:");
+                    for (size_t i=0; i<dir->getFileCount(); i++) {
+                        printf(" '%s'", dir->getFileName(i).string());
+                    }
+                    printf("\n");
+                }
+                delete dir;
+            }
         } else if (strcmp("configurations", option) == 0) {
             Vector<ResTable_config> configs;
             res.getConfigurations(&configs);
index 71b1a3c86317f6366f45e2dc8a071c029cbbbdfd..8bf2b075e6fe4d2250a55244c7375d069388e223 100644 (file)
--- a/Main.cpp
+++ b/Main.cpp
@@ -54,9 +54,10 @@ void usage(void)
         "   xmlstrings       Print the strings of the given compiled xml assets.\n\n", gProgName);
     fprintf(stderr,
         " %s p[ackage] [-d][-f][-m][-u][-v][-x][-z][-M AndroidManifest.xml] \\\n"
-        "        [-0 extension [-0 extension ...]] \\\n"
-        "        [-g tolerance] \\\n"
-        "        [-j jarfile] \\\n"
+        "        [-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile] \\\n"
+        "        [--min-sdk-version VAL] [--target-sdk-version VAL] \\\n"
+        "        [--max-sdk-version VAL] [--app-version VAL] \\\n"
+        "        [--app-version-name TEXT] \\\n"
         "        [-I base-package [-I base-package ...]] \\\n"
         "        [-A asset-source-dir] [-P public-definitions-file] \\\n"
         "        [-S resource-sources [-S resource-sources ...]] "
@@ -115,7 +116,17 @@ void usage(void)
         "       and the first match found (left to right) will take precedence."
         "   -0  specifies an additional extension for which such files will not\n"
         "       be stored compressed in the .apk.  An empty string means to not\n"
-        "       compress any files at all.\n");
+        "       compress any files at all.\n"
+        "   --min-sdk-version\n"
+        "       inserts android:minSdkVersion in to manifest.\n"
+        "   --target-sdk-version\n"
+        "       inserts android:targetSdkVersion in to manifest.\n"
+        "   --max-sdk-version\n"
+        "       inserts android:maxSdkVersion in to manifest.\n"
+        "   --version-code\n"
+        "       inserts android:versionCode in to manifest.\n"
+        "   --version-name\n"
+        "       inserts android:versionName in to manifest.\n");
 }
 
 /*
@@ -339,6 +350,59 @@ int main(int argc, char* const argv[])
                     bundle.setCompressionMethod(ZipEntry::kCompressStored);
                 }
                 break;
+            case '-':
+                if (strcmp(cp, "-min-sdk-version") == 0) {
+                    argc--;
+                    argv++;
+                    if (!argc) {
+                        fprintf(stderr, "ERROR: No argument supplied for '--min-sdk-version' option\n");
+                        wantUsage = true;
+                        goto bail;
+                    }
+                    bundle.setMinSdkVersion(argv[0]);
+                } else if (strcmp(cp, "-target-sdk-version") == 0) {
+                    argc--;
+                    argv++;
+                    if (!argc) {
+                        fprintf(stderr, "ERROR: No argument supplied for '--target-sdk-version' option\n");
+                        wantUsage = true;
+                        goto bail;
+                    }
+                    bundle.setTargetSdkVersion(argv[0]);
+                } else if (strcmp(cp, "-max-sdk-version") == 0) {
+                    argc--;
+                    argv++;
+                    if (!argc) {
+                        fprintf(stderr, "ERROR: No argument supplied for '--max-sdk-version' option\n");
+                        wantUsage = true;
+                        goto bail;
+                    }
+                    bundle.setMaxSdkVersion(argv[0]);
+                } else if (strcmp(cp, "-version-code") == 0) {
+                    argc--;
+                    argv++;
+                    if (!argc) {
+                        fprintf(stderr, "ERROR: No argument supplied for '--version-code' option\n");
+                        wantUsage = true;
+                        goto bail;
+                    }
+                    bundle.setVersionCode(argv[0]);
+                } else if (strcmp(cp, "-version-name") == 0) {
+                    argc--;
+                    argv++;
+                    if (!argc) {
+                        fprintf(stderr, "ERROR: No argument supplied for '--version-name' option\n");
+                        wantUsage = true;
+                        goto bail;
+                    }
+                    bundle.setVersionName(argv[0]);
+                } else {
+                    fprintf(stderr, "ERROR: Unknown option '-%s'\n", cp);
+                    wantUsage = true;
+                    goto bail;
+                }
+                cp += strlen(cp) - 1;
+                break;
             default:
                 fprintf(stderr, "ERROR: Unknown flag '-%c'\n", *cp);
                 wantUsage = true;
index b2bd9ffc35eca9628acec0b2919766908a735e88..49ccf718519b6d9becb0c5129ecf4d9ebb39e9e5 100644 (file)
@@ -495,6 +495,58 @@ static void applyFileOverlay(const sp<AaptAssets>& assets,
     return;
 }
 
+void addTagAttribute(const sp<XMLNode>& node, const char* ns8,
+        const char* attr8, const char* value)
+{
+    if (value == NULL) {
+        return;
+    }
+    
+    const String16 ns(ns8);
+    const String16 attr(attr8);
+    
+    if (node->getAttribute(ns, attr) != NULL) {
+        fprintf(stderr, "Warning: AndroidManifest.xml already defines %s (in %s)\n",
+                String8(attr).string(), String8(ns).string());
+        return;
+    }
+    
+    node->addAttribute(ns, attr, String16(value));
+}
+
+status_t massageManifest(Bundle* bundle, sp<XMLNode> root)
+{
+    root = root->searchElement(String16(), String16("manifest"));
+    if (root == NULL) {
+        fprintf(stderr, "No <manifest> tag.\n");
+        return UNKNOWN_ERROR;
+    }
+    
+    addTagAttribute(root, RESOURCES_ANDROID_NAMESPACE, "versionCode",
+            bundle->getVersionCode());
+    addTagAttribute(root, RESOURCES_ANDROID_NAMESPACE, "versionName",
+            bundle->getVersionName());
+    
+    if (bundle->getMinSdkVersion() != NULL
+            || bundle->getTargetSdkVersion() != NULL
+            || bundle->getMaxSdkVersion() != NULL) {
+        sp<XMLNode> vers = root->getChildElement(String16(), String16("uses-sdk"));
+        if (vers == NULL) {
+            vers = XMLNode::newElement(root->getFilename(), String16(), String16("uses-sdk"));
+            root->insertChildAt(vers, 0);
+        }
+        
+        addTagAttribute(vers, RESOURCES_ANDROID_NAMESPACE, "minSdkVersion",
+                bundle->getMinSdkVersion());
+        addTagAttribute(vers, RESOURCES_ANDROID_NAMESPACE, "targetSdkVersion",
+                bundle->getTargetSdkVersion());
+        addTagAttribute(vers, RESOURCES_ANDROID_NAMESPACE, "maxSdkVersion",
+                bundle->getMaxSdkVersion());
+    }
+    
+    return NO_ERROR;
+}
+
 #define ASSIGN_IT(n) \
         do { \
             ssize_t index = resources->indexOfKey(String8(#n)); \
@@ -1013,7 +1065,15 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
 
     // Generate final compiled manifest file.
     manifestFile->clearData();
-    err = compileXmlFile(assets, manifestFile, &table);
+    sp<XMLNode> manifestTree = XMLNode::parse(manifestFile);
+    if (manifestTree == NULL) {
+        return UNKNOWN_ERROR;
+    }
+    err = massageManifest(bundle, manifestTree);
+    if (err < NO_ERROR) {
+        return err;
+    }
+    err = compileXmlFile(assets, manifestTree, manifestFile, &table);
     if (err < NO_ERROR) {
         return err;
     }
index ef11a83c83875f4236bc16bbbd9c4d78ee53c52f..25ab1474d94863c3509dcc3da54f246f98954e24 100644 (file)
@@ -23,6 +23,16 @@ status_t compileXmlFile(const sp<AaptAssets>& assets,
     if (root == NULL) {
         return UNKNOWN_ERROR;
     }
+    
+    return compileXmlFile(assets, root, target, table, options);
+}
+
+status_t compileXmlFile(const sp<AaptAssets>& assets,
+                        const sp<XMLNode>& root,
+                        const sp<AaptFile>& target,
+                        ResourceTable* table,
+                        int options)
+{
     if ((options&XML_COMPILE_STRIP_WHITESPACE) != 0) {
         root->removeWhitespace(true, NULL);
     } else  if ((options&XML_COMPILE_COMPACT_WHITESPACE) != 0) {
@@ -1307,7 +1317,7 @@ status_t ResourceTable::addIncludedResources(Bundle* bundle, const sp<AaptAssets
             } else if (id != 0) {
                 if (id == 127) {
                     if (mHaveAppPackage) {
-                        fprintf(stderr, "Included resource have two application packages!\n");
+                        fprintf(stderr, "Included resources have two application packages!\n");
                         return UNKNOWN_ERROR;
                     }
                     mHaveAppPackage = true;
index 74ba326c2bf3c6969f29c705c6407f6ca93860cc..665232bb6d0dab5b18969ddd9788fd87a19ebea7 100644 (file)
@@ -15,6 +15,7 @@
 
 using namespace std;
 
+class XMLNode;
 class ResourceTable;
 
 enum {
@@ -34,6 +35,12 @@ status_t compileXmlFile(const sp<AaptAssets>& assets,
                         ResourceTable* table,
                         int options = XML_COMPILE_STANDARD_RESOURCE);
 
+status_t compileXmlFile(const sp<AaptAssets>& assets,
+                        const sp<XMLNode>& xmlTree,
+                        const sp<AaptFile>& target,
+                        ResourceTable* table,
+                        int options = XML_COMPILE_STANDARD_RESOURCE);
+
 status_t compileResourceFile(Bundle* bundle,
                              const sp<AaptAssets>& assets,
                              const sp<AaptFile>& in,
index d4765672274e90574a83ed554bf0039cb87b2a00..2a85bc7e8b6d55be36a6512a7f5e1de7620bff23 100644 (file)
@@ -524,12 +524,30 @@ const Vector<sp<XMLNode> >& XMLNode::getChildren() const
     return mChildren;
 }
 
+const String8& XMLNode::getFilename() const
+{
+    return mFilename;
+}
+    
 const Vector<XMLNode::attribute_entry>&
     XMLNode::getAttributes() const
 {
     return mAttributes;
 }
 
+const XMLNode::attribute_entry* XMLNode::getAttribute(const String16& ns,
+        const String16& name) const
+{
+    for (size_t i=0; i<mAttributes.size(); i++) {
+        const attribute_entry& ae(mAttributes.itemAt(i));
+        if (ae.ns == ns && ae.name == name) {
+            return &ae;
+        }
+    }
+    
+    return NULL;
+}
+
 const String16& XMLNode::getCData() const
 {
     return mChars;
@@ -550,6 +568,38 @@ int32_t XMLNode::getEndLineNumber() const
     return mEndLineNumber;
 }
 
+sp<XMLNode> XMLNode::searchElement(const String16& tagNamespace, const String16& tagName)
+{
+    if (getType() == XMLNode::TYPE_ELEMENT
+            && mNamespaceUri == tagNamespace
+            && mElementName == tagName) {
+        return this;
+    }
+    
+    for (size_t i=0; i<mChildren.size(); i++) {
+        sp<XMLNode> found = mChildren.itemAt(i)->searchElement(tagNamespace, tagName);
+        if (found != NULL) {
+            return found;
+        }
+    }
+    
+    return NULL;
+}
+
+sp<XMLNode> XMLNode::getChildElement(const String16& tagNamespace, const String16& tagName)
+{
+    for (size_t i=0; i<mChildren.size(); i++) {
+        sp<XMLNode> child = mChildren.itemAt(i);
+        if (child->getType() == XMLNode::TYPE_ELEMENT
+                && child->mNamespaceUri == tagNamespace
+                && child->mElementName == tagName) {
+            return child;
+        }
+    }
+    
+    return NULL;
+}
+
 status_t XMLNode::addChild(const sp<XMLNode>& child)
 {
     if (getType() == TYPE_CDATA) {
@@ -561,6 +611,17 @@ status_t XMLNode::addChild(const sp<XMLNode>& child)
     return NO_ERROR;
 }
 
+status_t XMLNode::insertChildAt(const sp<XMLNode>& child, size_t index)
+{
+    if (getType() == TYPE_CDATA) {
+        SourcePos(mFilename, child->getStartLineNumber()).error("Child to CDATA node.");
+        return UNKNOWN_ERROR;
+    }
+    //printf("Adding child %p to parent %p\n", child.get(), this);
+    mChildren.insertAt(child, index);
+    return NO_ERROR;
+}
+
 status_t XMLNode::addAttribute(const String16& ns, const String16& name,
                                const String16& value)
 {
index 86548a22c85805f8819a1b9e1980a6fd8b1d22b9..a9bea4312eccd0bd2e30bb0c3c562fb743bb8cb6 100644 (file)
--- a/XMLNode.h
+++ b/XMLNode.h
@@ -68,6 +68,8 @@ public:
     const String16& getElementName() const;
     const Vector<sp<XMLNode> >& getChildren() const;
 
+    const String8& getFilename() const;
+    
     struct attribute_entry {
         attribute_entry() : index(~(uint32_t)0), nameResId(0)
         {
@@ -91,6 +93,8 @@ public:
 
     const Vector<attribute_entry>& getAttributes() const;
 
+    const attribute_entry* getAttribute(const String16& ns, const String16& name) const;
+    
     const String16& getCData() const;
 
     const String16& getComment() const;
@@ -98,8 +102,14 @@ public:
     int32_t getStartLineNumber() const;
     int32_t getEndLineNumber() const;
 
+    sp<XMLNode> searchElement(const String16& tagNamespace, const String16& tagName);
+    
+    sp<XMLNode> getChildElement(const String16& tagNamespace, const String16& tagName);
+    
     status_t addChild(const sp<XMLNode>& child);
 
+    status_t insertChildAt(const sp<XMLNode>& child, size_t index);
+
     status_t addAttribute(const String16& ns, const String16& name,
                           const String16& value);