ionic-team/trapeze

XML file namespace

agoncalvesos opened this issue · 3 comments

Hey!

I'm experiencing an issue when trying to inject/delete/merge text in an XML file (the cordova config.xml file).
Here's my trapeze-conf file:

  xml:
    - file: config.xml
      target: widget
      delete: /widget/allow-navigation[@href='https://*/*']
    - file: config.xml
      target: widget
      inject: |
        <allow-intent href="https://*/*" />

And here is a sample of my config.xml file:

    android-versionCode="11"
    id="my-application.id"
    ios-CFBundleVersion="1.0"
    version="0.1"
    xmlns="http://www.w3.org/ns/widgets"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <allow-navigation href="https://*/*" />
</widget>

If I remove the xmlns="http://www.w3.org/ns/widgets" it works as expected! Any idea why?

Using v7.0.10.

Thanks!

Can you try

target: //*[local-name() = 'widget']

I'm facing a similar issue trying to update the "version" attribute in config.xml. currently using this, but it's not working...

project:
  xml:
    - file: config.xml
      target: widget
      attrs:
        version: "7.8.9"

@mlynch I tried your suggestion above but it didn't work :(