Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

i want a third value to be printed out, so i set it up in the root

use strict; use warnings; use XML::Twig; use File::Spec; use POSIX qw(strftime); my $spec_text = qr/^SLD/; my $path_tmp = $0; (my $volume,my $directories,my $file) = File::Spec->splitpath( $path_t +mp ); my $path = $volume . $directories; opendir (DIRREN, $path) || die ; my @RENDIR = readdir (DIRREN); close (DIRREN); shift(@RENDIR); shift(@RENDIR); open(OUT,'>','out.txt'); foreach my $file (@RENDIR) { if ($file =~ $spec_text){ my $mode = (stat($file))[9]; my $file_date = strftime "%Y%m%d", (localtime($mode)); my $file_date_ref = \$file_date; my $file_ref = \$file; XML::Twig->new( # the twig will only contain PHONENO/ENTRY and + REASON/ENTRY elements # (plus the root or it would not be a tree) twig_roots => { 'BL_USER/PHONENO/ENTRY' => 1, 'BL_DPLI_RECORD/REASON/ENTRY' +=> \&reason, 'BL_DPLI_RECORD/BL_DP_DUNNED/M +ONETARYVALUE/V' => 2, } ) ->parsefile($file); sub reason { my( $t, $reason)= @_; foreach my $phone_no ($reason->prev_siblings) { print OUT $phone_no->text , ";" , $reason->text , "; +" , $$file_ref , ";" , $$file_date_ref ,";",$reason->next_siblings, " +\n"; } $t->purge; } } } close(OUT);

with next_siblings i want to access the value but didn't work
when i set the root tu => 1 its printet out like an element of phone number
so whats wrong in my mind, whats screwed up ?

kd ultibuzz


In reply to RE: Confusion ,XML::SIMPLE with DATA:DUMPER by ultibuzz
in thread Confusion ,XML::SIMPLE with DATA:DUMPER by ultibuzz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found