Artificial intelligent assistant

how to parse the xml that have multiple properties and names if we are having a XML script like this , How to get the value of a particular name using XML parsing <?XML> <conf> <prop><name>something</name><value>1</value></prop> <prop><name>one thing</name><value>2</value></prop> <prop><name>another thing</name><value>3</value></prop> <prop><name>one more thing</name><value>4</value></prop> </conf> Let assume so many lines like this

Using XMLStarlet to get the `value` of the `prop` with `name` "`one thing`":


$ xmlstarlet sel -t -v '//prop[name = "one thing"]/value' -nl file.xml
2


This applies an XPATH query to the XML which selects the `value` node(s) beneath the `prop` node(s) that has a `name` node with value `one thing`, and then extracts those nodes' value.

I used `//prop` for brevity, which would find `prop` nodes anywhere in the document. You could change this to `/conf/prop` if you know that the `prop` nodes that you are interested in are always to be found under the root `conf` node.

The same thing with `xmllint`:


$ xmllint --xpath '//prop[name = "one thing"]/value/text()' file.xml
2

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 1b06338e2eb9765a3aeeddcd340b2530