1 1 2 Swedish Foo http://www.foo.se/bar/ International [... up to 40 other element pairs..] #### use strict; # er, um, I forgot use DBI; # for storing in SQL use XML::DOM; # roll through the nodes # XML pre-requisites my $file = "funkyapp.xml"; my $xp = new XML::DOM::Parser(); my $doc = $xp->parsefile($file); my $root = $doc->getDocumentElement(); my @nodes = $root->getChildNodes(); foreach my $node (@nodes) { # get child nodes (yes, "childs") if ($node->getNodeType() == 1) { # check element name foreach my $item (@childs) { if ($node->getNodeType() == 1) { my @childs = $node->getChildNodes(); # iterate through child nodes foreach my $item (@childs) { # check element name ################################################# if (lc($item->getNodeName) eq "name") { my $name = $item->getFirstChild()->getData; ################################################# } elsif (lc($item->getNodeName) eq "home_url") { my $url = $item->getFirstChild()->getData; ################################################# } elsif (lc($item->getNodeName) eq "stayonhost") { my $stayhost = $item->getFirstChild()->getData; ################################################# } elsif (lc($item->getNodeName) eq "staybelow") { my $staybelow = $item->getFirstChild()->getData; ################################################# } elsif (lc($item->getNodeName) eq "maxdepth") { my $maxdepth = $item->getFirstChild()->getData; } # elsif { # [... 40 other nodes.. ] } # Insert values into SQL here, this works } }