Skip to main content

I have file config.xmlconfig.xml:

<?xml version="1.0" encoding="utf-8"?> 
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" id="app" version="2.5" android-versionCode="20500"> 
<name>App title</name> 
<description>Dummy dummy text.</description> 
</widget>
<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" id="app" version="2.5" android-versionCode="20500">
    <name>App title</name>
    <description>Dummy dummy text.</description>
</widget>

I'd like to change value of element<name> element.

I've tried following:

xmlstarlet edit -L -u "/_:widget/name" -v "NEW_NAME" config.xml
xmlstarlet edit -L -u "/_:widget/name" -v "NEW_NAME" config.xml

and

xmlstarlet edit -L -u "//name" -v "NEW_NAME" config.xml
xmlstarlet edit -L -u "//name" -v "NEW_NAME" config.xml

But it hasn't changed the 'App title'App title value.

I have file config.xml:

<?xml version="1.0" encoding="utf-8"?> 
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" id="app" version="2.5" android-versionCode="20500"> 
<name>App title</name> 
<description>Dummy dummy text.</description> 
</widget>

I'd like to change value of element.

I've tried following:

xmlstarlet edit -L -u "/_:widget/name" -v "NEW_NAME" config.xml

and

xmlstarlet edit -L -u "//name" -v "NEW_NAME" config.xml

But it hasn't changed the 'App title' value.

I have file config.xml:

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" id="app" version="2.5" android-versionCode="20500">
    <name>App title</name>
    <description>Dummy dummy text.</description>
</widget>

I'd like to change value of <name> element.

I've tried following:

xmlstarlet edit -L -u "/_:widget/name" -v "NEW_NAME" config.xml

and

xmlstarlet edit -L -u "//name" -v "NEW_NAME" config.xml

But it hasn't changed the App title value.

Source Link
Ladislav M
  • 123
  • 1
  • 3

Update of XML value with xmlstarlet

I have file config.xml:

<?xml version="1.0" encoding="utf-8"?> 
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" id="app" version="2.5" android-versionCode="20500"> 
<name>App title</name> 
<description>Dummy dummy text.</description> 
</widget>

I'd like to change value of element.

I've tried following:

xmlstarlet edit -L -u "/_:widget/name" -v "NEW_NAME" config.xml

and

xmlstarlet edit -L -u "//name" -v "NEW_NAME" config.xml

But it hasn't changed the 'App title' value.