I get XML elements back when using xpath


#1

Hello,
when using XPATH to parse my XML file, i get the correct field but in the content I also get the element name back, what I dont want.
What I need to change?

My XML looks like this:

<VULN_DETAILS>
    <CVSS_SCORE>
        <CVSS_BASE>5</CVSS_BASE>
        <CVSS_TEMPORAL>3.7</CVSS_TEMPORAL>
    </CVSS_SCORE>
</VULN_DETAILS>

My config looks like this:

xpath => [
    "/VULN/CVSS_SCORE/CVSS_BASE", "CVSS_Base_Score",
    "/VULN/CVSS_SCORE/CVSS_TEMPORAL", "CVSS_Temporal_Score"
]

My output:

field: CVSS3_Base_Score       content: <CVSS_BASE>5</CVSS_BASE>
field: CVSS_Temporal_Score    content: <CVSS_TEMPORAL>3.7</CVSS_TEMPORAL> 

When I'm using the filter

store_xml => "true"

I get the following output:

 {
    "CVSS_BASE": [
         "5"
   ],
     "CVSS_TEMPORAL": [
          "3.7"
   ]
}

#2

edited to:

xpath => [
    "/VULN/CVSS_SCORE/CVSS_BASE/text()", "CVSS_Base_Score",
    "/VULN/CVSS_SCORE/CVSS_TEMPORAL/text()", "CVSS_Temporal_Score"
]

will help


(system) closed #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.