The sample file:
<settings
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>fake</id>
<username>username2</username>
<password>aa2</password>
</server>
<server>
<id>fake3</id>
<username>username3</username>
<password>aa3</password>
</server>
<server>
<id>gitlab-company-name</id>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>glpat-faketokenvalue-E</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
<mirrors>
[parially cut]
</mirrors>
For now I would like to return value of the settings -> servers -> server (where id = gitlab-company-name) -> configuration -> httpHeaders -> property -> name and value - separately.
The best what I figured out is:
xmlstarlet sel -t -m '//_:server[_:id="gitlab-company-name"]' -v '_:configuration' -n ${HOME}/.m2/settings.xml
but that returns all the spaces until the result as well, (they are truncated by the StackExchange formatting):
Private-Token
glpat-faketokenvalue-E
I piped that to sed and head/tail but it's a dirty workaround.
Anyone can help me to resolve that issue? Thank you in advance.