Aqui está a minha resposta à minha pergunta semelhante: p
echo -e "setrootns\ncd defaultns:beans\ndir *" | xmllint --shell applicationContext.xml | grep -v -E ' TEXT| content=' | gawk 'BEGIN{ RS="ELEMENT "; FS=" *\n"} { print "/beans/" $1 "/@" $2 }' | sed -re 's/ +ATTRIBUTE // | uniq'
/beans// > setrootns/@/ > cd defaultns:beans
/beans/jaxrs:server/@id
/beans/bean/@id
/beans/import/@resource
O comando echo "canaliza" os comandos de shell xmllint do followinf
# tell xmllint this xml has namespace declarations (not your case)
setrootns
# move to the first root node (PARTS in your case)
cd defaultns:beans
# list node contents
dir *
Resultado:
/ > setrootns
/ > cd defaultns:beans
beans > dir *
ELEMENT jaxrs:server
ATTRIBUTE id
TEXT
content=CreateSurveyService
ATTRIBUTE address
TEXT
content=/services
ELEMENT bean
ATTRIBUTE id
TEXT
content=routingDataSource
ATTRIBUTE class
TEXT
content=com.lsr.usc.datasource.routing.RegionCod...
O restante dos comandos é usado para analisar essa saída.