Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

<tag attr="something"/> IS XML the way it was originaly designed. XML tags are not required to have content, they can very well have only attributes or just appear in the file with no additional info. Do show us the code!

As far as programmer intervention goes ... you have to intervene somewhere. Of course you can use a module that takes only the XML and gives you a maze of objects and you really do not have to set up anything FOR THIS STEP of the XML processing. But then you have to navigate the maze to get your hands on the data. The first step is easy, but it doesn't take you far.

Or you can do some work upfront to specify some rules and obtain a data structure that's already tweaked to whatever you need to do with the data later.

Or you can use a parser that just splits the XML apart and hands you the individual pieces (which is what most styles of XML::Parser do) and you have to handle all the pieces of data immediately as they are found in the file.

Which style (or a combination of styles) works best for you and the task at hand is something you have to find out. And for XML::Rules ... you can ask it to infer the base set of rules from the DTD or example XMLs. If you do that and leave the ruleset alone, you basicaly end up with the first style. Except that you end up with a HashOfHashesAndArraysOfHashes... instead of objects. But you can tweak the ruleset to skip the stuff you are not interested in, reformat the structure to simplify the searches later, change some static rules to subroutines and handle the data as soon as that particular tag with all its contents is parsed, etc.

In either case DO show us the failing code using XML::Parser! We do want to see the problem. Or at least I do. Most likely it's something you do, but if there really is a bug in the module I need to know. 'Cause XML::Rules is based on XML::Parser.


In reply to Re^5: XML::Parser Tutorial by Jenda
in thread XML::Parser Tutorial by OeufMayo

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (7)
    As of 2014-07-22 09:52 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (109 votes), past polls