Error : Invalid character in entity name when & is in the <name>
See original GitHub issueBug Report
Problem
Can not include &
in the cordova app name without causing a build failure to occur when strings.xml is created.
What is expected to happen?
If I have properly escaped the & in the config.xml, it should also apply to the strings.xml.
What does actually happen?
It seems the &
is converted back to &
when strings xml is created, perhaps in prepare.js. This causes the cordova add command to fail.
Information
Given the following config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="xxx.xxx.xxxx" version="6.2.2" android-versionCode="622000062" versionCode="62" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:gap="http://phonegap.com/ns/1.0">
<name>TIMING & TRACKING</name>
<description>
Timing APP
</description>
Command or Code
Run the command to create the cordova project
cordova platform add android@10.1.1
Using cordova-fetch for cordova-android@10.1.1
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: me.rtrt.app.tsa
Name: TIMING & TRACKING
Activity: MainActivity
Android target: android-30
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@10.1.1
Invalid character in entity name
Line: 3
Column: 37
Char:
Then, checking the strings.xml that was created, you can find there is a non-escaped &
/platforms/android/app/src/main/res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- App label shown within list of installed apps, battery & network usage screens. -->
<string name="app_name">TIMING & TRACKING</string>
<!-- App label shown on the launcher. -->
<string name="launcher_name">@string/app_name</string>
<!-- App label shown on the task switcher. -->
<string name="activity_name">@string/launcher_name</string>
</resources>
Environment, Platform, Device
N/A
Version information
Android Cordova 10.1.1 MacOs 10.15.7 (catalina)
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top Results From Across the Web
What is invalid character entity &ccb - xml - Stack Overflow
This symbol has special semantics in xml in initiating an entity reference (kind of a symbolic constant) - you cannot use it in...
Read more >Solved: XML parse tool error - Invalid character reference
Solved: Hi everyone, I am using a SOAP API and downloading different fields with mixed string/numbers data from it.
Read more >ArcPy: Select_Analysis Invalid Characters - GIS Stack Exchange
My suggestion is to use the function to validate table names in arcpy: ... Don't know why the output name made a problem,...
Read more >Error: Invalid character in entity name - AppStudio
When I try to “Make Native App with Voltbuilder” (run android --debug) I keep getting the error, error: Error: Invalid character in entity...
Read more >Source code for html5lib.constants - Read the Docs
"cant-convert-numeric-entity": "Numeric entity couldn't be converted to character ... "invalid-character-in-attribute-name": "Invalid character in attribute ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Also looking forward for this one
Same, I need this fix in – is there plans to merge this pull request?