Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13484

Allow removing a whole XML element using <config-file>

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: cordova-common
    • Labels:

      Description

      Currently, <config-file> can only add an XML element to a config file, but not remove an element. <edit-config> can remove attributes from an element, but not whole elements.

      I'd like the ability to remove elements by adding something to config.xml instead of writing a hook.

      This is useful because some plugins include extra permissions which are not always needed (For example, cordova-plugin-file adds the WRITE_EXTERNAL_STORAGE permission, but not all apps that include cordova-plugin-file will actually write outside their data directory).

      Example syntax:

      <config-file mode="remove" parent="/manifest" target="AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android">
          <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
      </config-file>
      

      (Note the mode="remove", the default if absent should be "add")

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              imgx64 Ibrahim M. Ghazal
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: