I haven't written a line in Perl in 10 years but I was asked to turn this:
<?xml version="1.0" encoding="UTF-8"?> <sub-group-tree> <host-group host-baselines="true" suppress-excluded-services="true +" inverse-suppression="false" host-trap="false" name="inside-hosts"> <host-group id="65534" name="Catch All" host-baselines="true" +suppress-excluded-services="true" inverse-suppression="false" host-tr +ap="false"> <ip-address-ranges>10.0.0.0/8</ip-address-ranges> <ip-address-ranges>192.168.0.0/16</ip-address-ranges> </host-group> <host-group id="23" name="By Function" host-baselines="true" s +uppress-excluded-services="true" inverse-suppression="false" host-tra +p="false"> <host-group id="61" name="B2B" host-baselines="true" suppr +ess-excluded-services="true" inverse-suppression="false" host-trap="f +alse"> <ip-address-ranges>192.168.0.0/16, 192.167.0.0/16, 192 +.166.0.0/16</ip-address-ranges> </host-group> <host-group id="24" name="DMZ" host-baselines="true" suppr +ess-excluded-services="true" inverse-suppression="false" host-trap="f +alse"> <ip-address-ranges>192.168.0.1/16, 192.167.0.1/16, 192 +.166.0.1/16</ip-address-ranges> </host-group> <host-group id="139" name="Guest and Mobile Networks" host +-baselines="true" suppress-excluded-services="true" inverse-suppressi +on="false" host-trap="false"> <host-group id="55" name="CAG_Mobile" host-baselines=" +true" suppress-excluded-services="true" inverse-suppression="false" h +ost-trap="false"> <ip-address-ranges>10.126.0.0/16, 10.127.0.0/16, 1 +0.128.0.0/16</ip-address-ranges> </host-group> <host-group id="59" name="Guest Catch-All" host-baseli +nes="true" suppress-excluded-services="true" inverse-suppression="fal +se" host-trap="false"> <ip-address-ranges>10.126.0.0/16, 10.127.0.0/16</i +p-address-ranges> </host-group> <host-group id="45" name="Guest Wireless Networks" hos +t-baselines="false" suppress-excluded-services="true" inverse-suppres +sion="false" host-trap="false"> <ip-address-ranges>192.168.0.0/16, 192.167.0.0/16, + 192.166.0.0/16</ip-address-ranges> </host-group> </host-group> <host-group id="35" name="Infrastructure" host-baselines=" +true" suppress-excluded-services="true" inverse-suppression="false" h +ost-trap="false"> <host-group id="8" name="Firewalls" host-baselines="tr +ue" suppress-excluded-services="true" inverse-suppression="false" hos +t-trap="false"> <ip-address-ranges>192.168.0.1/16</ip-address-rang +es> <ip-address-ranges>192.168.0.2/16</ip-address-rang +es> </host-group> <host-group id="11" name="NAT Gateway" host-baselines= +"true" suppress-excluded-services="true" inverse-suppression="false" +host-trap="false" /> <host-group id="39" name="Network Devices" host-baseli +nes="true" suppress-excluded-services="true" inverse-suppression="fal +se" host-trap="false"> <ip-address-ranges>192.168.0.1/16</ip-address-rang +es> <ip-address-ranges>192.168.0.2/16</ip-address-rang +es> <ip-address-ranges>192.168.0.1/16</ip-address-rang +es> <ip-address-ranges>192.168.0.2/16</ip-address-rang +es> <ip-address-ranges>192.168.0.1/16</ip-address-rang +es> <ip-address-ranges>192.168.0.2/16</ip-address-rang +es> </host-group> </host-group> <host-group id="7" name="Internal 3rd Party Managed Device +s" host-baselines="true" suppress-excluded-services="true" inverse-su +ppression="false" host-trap="false" /> <host-group id="6" name="Other" host-baselines="true" supp +ress-excluded-services="true" inverse-suppression="false" host-trap=" +false"> <host-group id="18" name="Broadcast" host-baselines="t +rue" suppress-excluded-services="true" inverse-suppression="false" ho +st-trap="false"> <ip-address-ranges>255.0.0.0/8</ip-address-ranges> </host-group> <host-group id="17" name="Link-Local" host-baselines=" +true" suppress-excluded-services="true" inverse-suppression="false" h +ost-trap="false"> <ip-address-ranges>169.254.0.0/16</ip-address-rang +es> </host-group> <host-group id="19" name="Localhost" host-baselines="t +rue" suppress-excluded-services="true" inverse-suppression="false" ho +st-trap="false"> <ip-address-ranges>127.</ip-address-ranges> </host-group> <host-group id="14" name="Multicast" host-baselines="t +rue" suppress-excluded-services="true" inverse-suppression="false" ho +st-trap="false"> <ip-address-ranges>192.0.0.0/24</ip-address-ranges +> </host-group> </host-group> <host-group id="5" name="Users" host-baselines="false" sup +press-excluded-services="true" inverse-suppression="false" host-trap= +"false"> <host-group id="3" name="Desktops" host-baselines="fal +se" suppress-excluded-services="true" inverse-suppression="false" hos +t-trap="false" /> <host-group id="33" name="Remote VPN IP Pool" host-bas +elines="false" suppress-excluded-services="true" inverse-suppression= +"false" host-trap="false" /> </host-group> <host-group id="12" name="VoIP" host-baselines="false" sup +press-excluded-services="true" inverse-suppression="false" host-trap= +"false"> <host-group id="37" name="Endpoints" host-baselines="t +rue" suppress-excluded-services="true" inverse-suppression="false" ho +st-trap="false" /> <host-group id="13" name="Gateways" host-baselines="tr +ue" suppress-excluded-services="true" inverse-suppression="false" hos +t-trap="false"> <ip-address-ranges>192.168.0.1/16</ip-address-rang +es> </host-group> </host-group> </host-group> <host-group id="43" name="By Location" host-baselines="false" +suppress-excluded-services="false" inverse-suppression="false" host-t +rap="false"> <host-group id="77" name="Amhearst" host-baselines="true" +suppress-excluded-services="true" inverse-suppression="false" host-tr +ap="false"> <ip-address-ranges>10.10.10.1/16</ip-address-ranges> <ip-address-ranges>192.168.0.0/16</ip-address-ranges> </host-group> <host-group id="79" name="Springfield" host-baselines="tru +e" suppress-excluded-services="true" inverse-suppression="false" host +-trap="false"> <ip-address-ranges>192.168.0.1/24</ip-address-ranges> </host-group> </host-group> </host-group> </sub-group-tree>
Into this:
Group.Servers.AllServers 10.100.10.0/24 Group.Servers.Mail 10.100.1.10/32 Group2.Development.Lab 172.16.0.0/22 Group2.Development.Linux 172.16.12.9/32
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!

In reply to Nested XML Question by zelet

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.