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' ] );
In reply to XML parsing by asa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |