Now, what am I trying to do. I have an XML document that I have to parse. I can parse everything, except for multiple drivers and vehicles. Everything I run this I only get one driver when I have two drivers. The beginning tag is <driver id=> (what I'm searching off of). The same with vehicles.

I knew nothing about XML till the last day (now I know next to nothing). Then I had to parse some XML and I had heard about XML::Simple judging that if it were really simple, then it would have been the right tool for me. Indeed, it turned out to be. It just slurped the XML (file or string) into a handy, familiar Perl data structure. For multiple tags I get an arrayref, and that's it. So all in all if you don't need the full, lower lever, parsing power of XML::Parser, you may try it as well. OTOH the code you posted at first sight seems to verbose for me to want to delve into it in enough detail (not to mention the fact that at first sight I see many things I don't like), and although somebody will probably be less lazy than I am, I bet many will be scared about it too, so I recommend preparing a minimal example exhibiting the problem yourself.


In reply to Re: While in XML document by blazar
in thread While in XML document by curtisb

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.