Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML file namespace #190

Open
agoncalvesos opened this issue May 14, 2023 · 3 comments
Open

XML file namespace #190

agoncalvesos opened this issue May 14, 2023 · 3 comments

Comments

@agoncalvesos
Copy link

agoncalvesos commented May 14, 2023

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!

@agoncalvesos
Copy link
Author

Related to goto100/xpath#36

@mlynch
Copy link
Contributor

mlynch commented May 22, 2023

Can you try

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

@mherbertecifm
Copy link

mherbertecifm commented Jan 22, 2024

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 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants