Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: XML Parsing,

by Sewi (Friar)
on Sep 09, 2009 at 10:48 UTC ( [id://794320]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use XML::Simple;
    ...
    foreach $file (@xmlfile){
    $xml = $ipath.$file;
    }
    
  2. or download this
    if (lc($xml) =~ "don"){&doncaster} else {
    if (lc($xml) =~ "ayl"){$holding = "asmholding"};
    ...
    if (lc($xml) =~ "hills"){$holding = "hilholding"};
    if (lc($xml) =~ "windley"){$holding = "wlsholding"};
    if (lc($xml) =~ "ppm"){$holding = "ppmholding"};
    
  3. or download this
    print "Other Cars<br>";
    
    ...
    $exportid = "$config->{Header}->{ExportID}";
    $numveh = "$config->{Summary}->{NumberOfVehicles}";
    $memid = "$config->{Header}->{MemberID}";
    
  4. or download this
    $lineno = 10;
    $vehicleno = 1;
    ...
    $make = "$vehicle->{Manufacturer}";
    $model = "$vehicle->{Model}";
    [...]
    
  5. or download this
    $image1 = "$vehicle->{Images}->{Image_1}";
    $image2 = "$vehicle->{Images}->{Image_2}";
    ...
    $image10 = "$vehicle->{Images}->{Image_10}";
    $image11 = "$vehicle->{Images}->{Image_11}";
    $image12 = "$vehicle->{Images}->{Image_12}";
    
  6. or download this
     for my $ImgNo (1..12) {
      # Storing them into an array is easy:
    ...
      # or you may want to keep the variable names:
      eval('$image'.$ImgNo.'=$vehicle->{Images}->{"Image_".$ImgNo};');
     }
    
  7. or download this
    ###########Write CSV############
    
    ...
    $trim =~ tr/,//d ;
    
    open (FILENAME,">$add3");
    
  8. or download this
    print FILENAME "Ref No,Make,Model,Trim,Vehicle Sub Class,Colour,Engine
    + Size,Fuel Type,Transmission,Year,Mileage,Registration No,Keys Suppli
    ...
    +$transpeed $trantype,$year,$mileage,$reg,$keyssupplied,$damage,$hasva
    +t,$starts $drives,No,$abicat,$reserve,na,$memid,$memid,$memid,$memid,
    +$auctionid,na,\n";
    
  9. or download this
    print FILENAME join(',',
        $exportid.$lineno, #$add5 is defined this way some lines before
    ...
        [...]
        @image,
        )."\n";
    
  10. or download this
    close FILENAME ;
    print "<table width=400>";
    ...
    rename ($ipath.$image1, $ipath.$jpg1);
    print "<td colspan=2>Image 1 Renamed</td></tr>";
    }
    
  11. or download this
    $Char = "a";
    for (@images) {
     next if $_ eq ''; # if you didn't filter them above
     rename $ipath.$_,$ipath.$add5.$add6.($Char++).'.jpg';
    }
    
  12. or download this
    opendir THEDIR, "$ipath";
    for $file (grep (/$str/, readdir THEDIR)) {
     # Do the work
    }
    closedir THEDIR;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://794320]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-25 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found