asa has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I am trying to parse a XML file, but I get this error Not a HASH reference at ./parser.pl line 42
At Line 42,
When I checked the line that cause this issue in the XML file, I can see maybe because the tag is repeated. Not really sure!print REPORT '<td>' . $e->{desc}->{descript}->{content} . '</td><td><br>';
I think I should add a keyattr, but I don't know how! I think it should be something like this KeyAttr => {descript=>"+source"} I have already this part in the code<entry type="CVE" severity="Medium" seq="1999-0453" published="1999-01 +-01" name="CVE-1999-0453" modified="2008-09-05" CVSS_version="2.0" CV +SS_vector="(AV:N/AC:L/Au:N/C:P/I:N/A:N)" CVSS_score="5.0" CVSS_impact +_subscore="2.9" CVSS_exploit_subscore="10.0" CVSS_base_score="5.0"> <desc> <descript source="cve">An attacker can identify a CISCO device b +y sending a SYN packet to port 1999, which is for the Cisco Discovery + Protocol (CDP).</descript> <descript source="nvd">Please see the following link for more in +formation:http://seclists.org/bugtraq/1999/Jan/0215.html</descript> </desc>
Thanks.$data = $xml->XMLin( $ARGV[0], KeyAttr => { cve => 'entry'}, ForceArray => [ 'cve', 'ref' ] );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML parsing
by tobyink (Canon) on Jan 09, 2012 at 08:29 UTC | |
by asa (Novice) on Jan 13, 2012 at 13:30 UTC | |
by Jenda (Abbot) on Jan 13, 2012 at 14:07 UTC | |
by asa (Novice) on Jan 13, 2012 at 19:08 UTC | |
|
Re: XML parsing
by trizen (Hermit) on Jan 09, 2012 at 01:35 UTC | |
by asa (Novice) on Jan 09, 2012 at 08:31 UTC |