Sample Header Ad - 728x90

Update XML parameter, with namespace, using xmlstarlet

1 vote
1 answer
1164 views
I have this XML file:
PORT_ID
        47827
    
    
        POS_PRINTER_PORT_ID
        27001
    
    
        PDS_WS_LOCATION
        http://localhost:8080/pds-jbrain-ws/pdsservice?wsdl
I'm trying to update the POS_PRINTER_PORT_ID value, but I'm having a hard time getting it right. I've tried the below commands:
xmlstarlet ed -u '/engineConfiguration/engineParameter/POS_PRINTER_PORT_ID' -v 9999 engineConfiguration.xml
xmlstarlet ed -N s=http://bla.com/engine/management/engineConfiguration  -u '/s:engineConfiguration/s:engineParameter[name = "POS_PRINTER_PORT_ID"]/value' -v 999 engineConfiguration.xml
I was also trying with xmllint but read that xmlstarlet is the way to go.
Asked by Dave Macias (13 rep)
Jun 15, 2021, 04:42 PM
Last activity: Jun 15, 2021, 06:25 PM