Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Parse XML to my own objects?

by conrad (Beadle)
on Jun 28, 2005 at 13:27 UTC ( [id://470618]=note: print w/replies, xml ) Need Help??


in reply to Re: Parse XML to my own objects?
in thread Parse XML to my own objects? (aka XML Data Binding)

So in XML::Parser in Stream and Subs mode they're definitely not per-element, so you'd need a gigantic switch-or-equivalent statement in your one-and-only StartTag routine to identify and instantiate the particular class you're after, plus it maintains no context (such as a parse stack) for you to tie into (I understand that this is a major reason for writing most of the other Perl XML parsers in fact, even though you can kind-of work around the problem using closures), plus it's not at all OO.

XML::Twig also doesn't seem to have a good solution, in that it instantiates all elements in the same class — a user-selected class to be sure, but always the same one.

I've discovered a name for what I'm after: XML Data Binding. Here's an article on the subject. It's Java-centric though, and doesn't offer any Perl answers...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://470618]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-19 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found