I am trying to parse the XML data from the output of cppcheck. But the XML structure seems wrong.
cppcheck src --enable=warning,style,unusedFunction --xml --inconclusive --std=posix --std=c++11 2> error_s.xml
cppcheck XML output:
<?xml version="1.0" encoding="UTF-8"?>
<results version="2">
<cppcheck version="1.82"/>
<errors>
<error id="funcArgNamesDifferent" severity="style" msg="Blah Blah bLah." verbose="Blah Blah Verbose" cwe="628" inconclusive="true">
<location file="src/DataLayer/ABC.cpp" line="329"/>
<location file0="src/DataLayer/ABC.cpp" file="src/DataLayer/ABC.h" line="64"/>
<location file0="src/DataLayer/ABC.cpp" file="src/DataLayer/ABC.h" line="64"/>
<location file0="src/DataLayer/ABC.cpp" file="src/DataLayer/ABC.h" line="64"/>
</error>
</errors>
</results>
Shouldn't the location
node be inside an array like locations
?
<locations>
<location file="src/DataLayer/ABC.cpp" line="329"/>
<location file0="src/DataLayer/ABC.cpp" file="src/DataLayer/ABC.h" line="64"/>
</locations>
unfortunately it cannot be accessed with out writting too many if-statements ..
if(isset($location)){
}
Conversation with CppChecker Developer.. Hopefully it would get fixed when they release v3
for now, the only way to access is using too many if-Statements.
if not, there is also library htmlreport which will generate html pages..