XML::Parser is definitely the more powerful of the two
options, but it's more complex to use. One way to use it
is to process the XML as a stream; you give the parser some
callback functions to use as handlers, and those
functions get called each time a specific "event" occurs
in the parser: the start of a tag, the end of a tag,
character (non-markup) data. XML::Parser also has "styles"
that make it easier to use (like a "Tree" style that loads
your data into a tree--although don't expect a nice hash
like XML::Simple gives you).
XML::Simple returns a hash reference, so couldn't
you write a recursive routine that descends through that
hash and does whatever validation you want on it?
There are a bunch of XML modules, and here's a really good
article about them: Processing XML with Perl.
From what you said, you may be best off just going with
XML::Simple and writing a sub to recurse through the hash.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.