in reply to Re^2: extracting attribute values which might have multiple occurences from xml file
in thread extracting attribute values which might have multiple occurences from xml file

You are mixing XML::Twig with XML::XSH2.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re^3: extracting attribute values which might have multiple occurences from xml file

Replies are listed 'Best First'.
Re^4: extracting attribute values which might have multiple occurences from xml file
by perlDevsWorld (Novice) on Jan 30, 2015 at 22:34 UTC
    @Choroba: Thanks so much for the help!. Its working now.
Re^4: extracting attribute values which might have multiple occurences from xml file
by perlDevsWorld (Novice) on Jan 30, 2015 at 22:13 UTC
    @choroba: Apologies still trying to catch up with perl.
    #! perl -w use warnings; use strict; use XML::XSH2; open "C:\\location\\test.xml" ; for /httpsRoutes/httpsRoute echo @hostname (key) @tier | cat > out.txt

    Errors I'm getting:

    C:\Strawberry\perl\bin>perl "C:\location\xmlRead_3.pl Array found where operator expected at C:\location\xmlRead_3.pl line 8 +, at end of line (Missing operator before ?) Array found where operator expected at C:\location\xmlRead_3.pl line 8 +, at end of line (Missing operator before ?) Unknown regexp modifier "/h" at C:\location\xmlRead_3.pl line 7, at en +d of line Unknown regexp modifier "/t" at C:\location\xmlRead_3.pl line 7, at en +d of line Unknown regexp modifier "/t" at C:\location\xmlRead_3.pl line 7, at en +d of line Unknown regexp modifier "/R" at C:\location\xmlRead_3.pl line 7, at en +d of line Unknown regexp modifier "/t" at C:\location\xmlRead_3.pl line 7, at en +d of line Unknown regexp modifier "/e" at C:\location\xmlRead_3.pl line 7, at en +d of line syntax error at C:\location\xmlRead_3.pl line 7, near "for /httpsRoute +s/httpsRoute" Global symbol "@hostname" requires explicit package name at C:\locatio +n\xmlRead_3.pl line 8. Global symbol "@tier" requires explicit package name at C:\location\xm +lRead_3.pl line 8. Execution of C:\location\xmlRead_3.pl aborted due to compilation error +s.
      Have you read the documentation to XML::XSH2? Also, as you seem to be on MS Windows, you should use type instead of cat.
      #!/usr/bin/perl use XML::XSH2; xsh << '__XSH__'; open 'C:\location\test.xml' ; for /httpsRoutes/httpsRoute echo @hostname (key) @tier | type > out.txt __XSH__
      (untested)
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ