![]() |
|
Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
I've been puzzling over this too long, and am sure I'm just not looking at it the right way. Hopefully someone with some experience with XML::Twig will have a suggestion. I'm working on improving some of the datastructures returned by PerlMonks::Mechanized. One of the easiest ones to work with is just eluding me. Specifically, I'm updating the method that parses the Monastery's XML thread ticker returning a concise but useful datastructure. The problem is that the datastructure returned by XML::Twig (and previously XML::Simple) isn't as simple as it should be; it contains extra levels of indirection that are unneeded. It wouldn't be all that hard to simply traverse the structure returned by XML::Twig, modifying the datastructure to remove extra indirection, but somehow I believe XML::Twig is capable of giving me what I want in the first place. But over the past few days I've convinced myself that I don't understand XML::Twig enough to get the most out of this highly flexible module. Here is a simplified snippet of code that gives an example of what I'm doing.
As you can see, I've commented out the group_tags attribute, because it wasn't gaining me anything, at least how I was using it. The output I'm getting is:
I'm close, but what I really want is:
In other words, the node => {... is extra indirection that I don't need or want. Any tips on how to coax this out of XML::Twig? Dave In reply to How to simplify the datastructure returned by XML::Twig by davido
|
|