<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: No data displayed when extract fields from xml data in a log file using xpath in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/No-data-displayed-when-extract-fields-from-xml-data-in-a-log/m-p/461221#M79608</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;...
| xmlkv | spath path="tmsTrip.purchasedCost.purchasedCostTripSegment.origin.ns2:numberCode" output=Origin
| table purchCostReference, eventType,carrier, billingMethod, Origin
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 23 May 2020 02:18:12 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-05-23T02:18:12Z</dc:date>
    <item>
      <title>No data displayed when extract fields from xml data in a log file using xpath</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/No-data-displayed-when-extract-fields-from-xml-data-in-a-log/m-p/461220#M79607</link>
      <description>&lt;P&gt;I am using Splunk to extract a number of fields from xml data this is contained in a log file.&lt;BR /&gt;
The file is very large.  This is part of it.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt; xmlns:ns2="http://ground.fedex.com/schemas/linehaul/TMSCommon"&amp;gt;
   PURCHASEDLINEHAUL
   APPROVE
   116029927
   104257037
   104257037
   1
   2020-02-20T21:53:39.000Z
.... more lines here that are not important


         1587040
         FXTR
         DRAY
         RULE
         PZ1

            923
            RLTO
            330 RESOURCE DRIVE
            LH PHONE 877-851-3543
            true
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;This query selects the xml part text in the logging file and some of the fields are extracted and I can add to a table. (not including the source and sourcetype..)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| xmlkv | table purchCostReference, eventType, carrier, billingMethod
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But need more fields that are child elements within the xml data. One of them is the &lt;STRONG&gt;numberCode&lt;/STRONG&gt;. I am trying to use &lt;STRONG&gt;xpath&lt;/STRONG&gt; to extract these additional fields.  &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt;| xmlkv | xpath
"//tmsTrip/purchasedCost/purchasedCostTripSegment/origin/ns2:numberCode"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;outfield=Origin | table&lt;BR /&gt;
purchCostReference, eventType,&lt;BR /&gt;
carrier, billingMethod, Origin&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;But no Origin data is returned when I add the field to the table.  There is no error.  The Origin column is empty.&lt;BR /&gt;
What am I doing wrong with the xpath command that it is not showing any data?&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 16:14:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/No-data-displayed-when-extract-fields-from-xml-data-in-a-log/m-p/461220#M79607</guid>
      <dc:creator>3618475</dc:creator>
      <dc:date>2020-05-21T16:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: No data displayed when extract fields from xml data in a log file using xpath</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/No-data-displayed-when-extract-fields-from-xml-data-in-a-log/m-p/461221#M79608</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;...
| xmlkv | spath path="tmsTrip.purchasedCost.purchasedCostTripSegment.origin.ns2:numberCode" output=Origin
| table purchCostReference, eventType,carrier, billingMethod, Origin
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 May 2020 02:18:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/No-data-displayed-when-extract-fields-from-xml-data-in-a-log/m-p/461221#M79608</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-23T02:18:12Z</dc:date>
    </item>
  </channel>
</rss>

