http://www.perlmonks.org?node_id=1050166


in reply to extracting attribute values which might have multiple occurences from xml file

Using XML::XSH2, a wrapper around XML::LibXML:
open file.xml ; my $count = 0 ; for //certDet { $count = $count + 1 ; echo :s Entry $count ':' ; echo :s 'DN="' xsh:subst(@subjectDN, ';', '&') '"' ; echo :s CN= xsh:match(@subjectDN, 'CN=(.*)') ; echo :s env= @env ; echo :s key= (key) ; }
The output is a bit different from what you posted:
2c2 < DN="/C=US/ST=NC/L=Raleigh/O=DotNet/OU=ET&D/CN=test1.xxxx.com" --- > DN="/C=US/ST=NC/L=Raleigh/O=DotNet/OU=ETD&D/CN=test1.xxxx.com" 9,10c9,10 < env=QA < key=1234 --- > env=dev > key=27166
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: extracting attribute values which might have multiple occurences from xml file
by tinkuPerlMonk2 (Initiate) on Aug 20, 2013 at 13:17 UTC
    Thanks you choroba for your input!!!!!!