Questions tagged [xmlstarlet]
Open source command line utility for XML file processing.
47 questions
0 votes
1 answer
75 views
Unable to extract some properties from Maven settings.xml using either xmllint or xmlstarlet
I have a Maven settings file at ~/.m2/settings.xml. I need to write some scripting that extracts the username and password from one of the server entries. I've tried using both "xmllint" ...
0 votes
1 answer
440 views
XMLStarlet with using a variable in XPath expression
I have this command: find . -iname '*.xml' | xargs xmlstarlet sel -N z="http://abc.com/article/1.0/" \\ --var zgtag="SuperTag" -t -m "/z:profile-extension" -i "//z:...
3 votes
1 answer
449 views
'xmlstarlet edit' using a variable as XPath
When you follow the doc: xmlstarlet edit --help you can read that --var can be used to declare a XPath expression as a variable. Generating moc file: cat<<EOF > /tmp/file.xml <root> &...
3 votes
2 answers
2k views
Remove all namespace attributes from xml using xmlstarlet
I want to remove all the namespace attributes from the following XML. <md:EntityDescriptor xmlns="urn:_" xmlns:md="_"></md:EntityDescriptor> I have tried to remove ...
5 votes
2 answers
606 views
how to delete a div with a specific class from XHTML using xstarlet?
I have several hundred .xhtml files in a sub-directory(*) and I want to delete all DIVs with a specific class (and the entire contents of those DIVs - including other divs, spans, image and paragraph ...
2 votes
1 answer
148 views
How to untag, in an XML file, a chain of tagged characters that are embedded within specified tags
What is the xmlstarlet command to untag, in an XML file, a chain of tagged characters that are embedded within specified tags? Example: searching every occurrence of the tag <b>, that needs to ...
-1 votes
1 answer
65 views
Change the version number from 97 to 98 in an XML file [closed]
I want to change the version number with respect to the ip. For example for this ip 10.228.134.226, it should change the version number from 97 to 98 <qa:browsers> <browser name="...
0 votes
1 answer
495 views
xmlstarlet command for batch processing .xhtml files
I've tried xmlstarlet for processing an individual .xhtml files. xmlstarlet fo --omit-decl --recover --html file.xhtml This command process an individual files and prints output on terminal only. ...