With xmllint/xpath, parse out the value of several attributes



For a given xml file called configurations.xml I would like to extract the value of each conf element, and store it in a variable for later use.



<configurations>
<conf name="bob"/>
<conf name="alice"/>
<conf name="ted"/>
<conf name="carol"/>
</configurations>


The expected output is:



bob
ailce
ted
carol


I have xpath and xmllint available. A xpath of //conf/@name gets the nodes, but outputs as name="bob", which is what I'm trying to avoid.


No comments:

Post a Comment