12
Este es el XML de datos:xmlstarlet seleccione el valor de
<DATA VERSION="1.0">
<TABLES>
<ITEM>
<identifyer V="1234"></identifyer>
<property1 V="abcde"></property1>
<Property2 V="qwerty"></property2>
</ITEM>
<ITEM>
<identifyer V="5678"></identifyer>
<Property1 V="zyxwv"></property1>
<Property2 V="dvorak"></property2>
</ITEM>
</TABLES>
</DATA>
Estoy tratando de encontrar property2
del elemento en el que identifyer
tiene valor 1234
. Puedo seleccionar los datos:
$ xmlstarlet sel -t -c "/DATA/TABLES/ITEM/identifyer [@V=1234]" test.xml
<identifyer V="1234"/>
Dos tipos de salida serían deseables:
$ xmlstarlet <some magic>
<identifyer V="1234"></identifyer>
<property1 V="abcde"></property1>
<Property2 V="qwerty"></property2>
Y:
$ xmlstarlet <some magic>
qwerty
Genial, eso funciona :) Es bueno ver la sintaxis en un ejemplo, puedo seguir adelante con esto. ¡Gracias! – joepd