Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Nested XML Question (question_

by Anonymous Monk
on Jun 25, 2013 at 01:55 UTC ( #1040516=note: print w/replies, xml ) Need Help??

in reply to Nested XML Question

I've been working on this for 12 hours and have gotten just about nowhere. Could somebody provide me some guidance? Anything to get me going in the right direction? I'm completely swimming. Thanks!

Show us what you have and explain what problems you have

Are you having trouble parsing the xml?

I guess you might, but then your "wanted output" doesn't match anything obvious in the xml -- step 1 might be identify output 1 not merely output final :)

use XML::Twig :) it comes with many examples/tutorials, XML::Twig, XML::LibXML, Mojo::DOM ... see Re: The best module for handling xml for examples, walkthroughs, follow my links and the links they link, like these Re: How to grab a portion of file with regex (don't)(parsing html/xml with xpath/twig/dom, because html::parser is low level), Re: How to grab a portion of file with regex (parsing html/xml with xpath/twig/dom, because xml::parser is low level), Re^4: How to grab a portion of file with regex (parsing html/xml with xpath/twig/dom, because ::parser is low level)

Are you having trouble de-ranging the network ranges (or whatever the networking cidr term is) or whatever is you're calculating from the XML ? (the strings don't relate in an obvious way -- maybe obvious to you but most folks don't networks all day)

See converting complex netrange to cidr notation, Net::IP::RangeCompare, regex for classless IP subnets, Managing your IP space with Perl

Replies are listed 'Best First'.
Re^2: Nested XML Question (question_
by zelet (Initiate) on Jun 25, 2013 at 03:46 UTC
    Thanks for the quick reply. I was so neck-deep in this stuff all day I didn't explain it well. For example, the first couple lines of the output file (as related to the original XML I posted) would be this:
    inside-hosts inside-hosts.catchall inside-hosts.catchall inside-hosts.By Function inside-hosts.By Function.B2B inside-hosts.By Function.B2B inside-hosts.By Function.B2B inside-hosts.By Function.DMZ ... etc ... inside-hosts.By Function.Infrastructure inside-hosts.By Function.Infrastructure.Firewalls inside-hosts.By Function.Infrastructure.Firewalls
    My biggest issue is figuring out how to loop through the XML and parse out the name and the IP ranges and create the <tab> IP/range structure.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040516]
Jar. Jar!...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2017-09-24 10:47 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (274 votes). Check out past polls.