All the perl code underneath has question marks in places where there needs to be a variable, not an exact word like "type" as a reference, a variable reference. So no word that is in my xml should be in the perl scirpt
<?xml version="1.0" encoding="ISO-8859-1"?> <A> <B> <C> <element type="k" name="p" online="yes"/> <element type="i" name="e" online="yes"/> <element type="y" name="z" online="yes"/> <element type="a" name="q" online="yes"/> <element type="z" name="d" online="yes"/> <element type="t" name="p" online="yes"/> </C> </B> </A>
And after posting here, and reading some stuff I got to somethings like this. This code needs to be universal, I just don't get it with the referencing thing, if it is necassary. I suppose so. But let me just remark that I need to get down to the attributes, only A B and C will be there as nested elements.
#!/usr/bin/perl -- use strict; use warnings; use Cwd; use XML::Simple; my $dir = cwd(); opendir(DIR, "."); my @files = grep(/\.xml$/,readdir(DIR)); closedir(DIR); foreach my $file (@files) { my $xs1 = XML::Simple->new(); my $doc = $xs1->XMLin($file, keyattr=>['????????'], ForceContent=>1, F +orceArray=>1); use Data::Dumper; local $Data::Dumper::Indent=1; for my $sub ( sort keys %{ $doc->{???????} } ){ $rowCount = $tellerR; $worksheet->Cells($rowCount, $colCount)->{Value} = $sub; for my $elem ( sort keys %{ $doc->{??????}{$sub} } ){ # More simalar onces ?? Or... for my $element ( @{ $doc->{???????}{$sub}{$elem} } ){ } } } }

In reply to Re^2: XML :: Simple by Sporti69
in thread XML :: Simple by Sporti69

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.