Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Good points. As Jeffa pointed out, it isn't just Perl that can have complex structures (hashes of hashes, etc) created from the XML Parsers. What is the frustrating part is that in several of the XML parser modules, the structures can become unnecessarily complex. Given the unknown data coming in, most of the parsers create the memory structures in a generic way. Not a bad thing, it just tends be cumbersome.

One problem that can arise is that the information you are looking for may not be at a consistent location within the structure which would eliminate any XML Path tools. If the data is properly tagged, then you can use rules or similar based tools. These were mentioned in earlier replies so I'm not going to rehash them.

How is this the fault of Perl? It's not. Perl, itself, knows nothing about XML. The wide variety of XML parsers within CPAN does give us a clue that the problem is really with how flexible XML can be and how some XML data sources can really make parsing it very difficult. The XML parsers do their best at parsing it but there is no best XML parser module for the majority of the XML data sources.. in some simplistic cases, such as Flickr's REST web service, XML::Simple works just fine and produces data structures that are well suited for the simple XML data. In others..

Is this a bit more clear?

The title is now "Modified title: The structures created by many of the XML parsers in Perl appear unnecessarily deep in levels..." which I hope is a bit less inflammatory. Otherwise, we'll have to get a bucket full of valium for some perlmonks ;-) (Just teasing)

Jason L. Froebe

Blog, Tech Blog


In reply to Re^4: Why oh why is working with XML so bloomin' difficult in Perl? by jfroebe
in thread Modified title: The structures created by many of the XML parsers in Perl appear unnecessarily deep in levels... by jfroebe

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-03-28 18:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found