如何使用Shell显示带有值的xml标记

时间:2018-09-11 12:23:33

标签: xml maven xml-parsing pom.xml artifact

我有一个输入xml

XML:

<artifactHits>
<artifactID>test</artifactID>
<version>1.0</version>
<latestversion>1.0<latestversion>

I need to print the value of artifactId along with the tag name.

Expected output: 
<artifactID>test</artifactID>

Present output:
test

Command tried:
sed -n 's%.<artifactID>\(.*\)</artifactID>.%/1\%p' test.xml

请帮助获取带有namevalue的标签的输出

0 个答案:

没有答案