<?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: How to extract all children in xml? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-all-children-in-xml/m-p/319577#M59685</link>
    <description>&lt;P&gt;have you tried xpath instead?&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Xpath"&gt;https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Xpath&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;it still might be tricky to get all of them under comments, but what if you just tried &lt;CODE&gt;|xpath outfield=Comments "//Field/Comments"&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Jan 2018 14:39:54 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2018-01-19T14:39:54Z</dc:date>
    <item>
      <title>How to extract all children in xml?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-all-children-in-xml/m-p/319576#M59684</link>
      <description>&lt;P&gt;I have part of an xml file which looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Field name="Name1" type="string" length="16"&amp;gt;
    &amp;lt;Comments&amp;gt;
        &amp;lt;p/&amp;gt;Value 1
    &amp;lt;/Comments&amp;gt;
&amp;lt;/Field&amp;gt;
&amp;lt;Field name="Name2" type="string" length="8"&amp;gt;
    &amp;lt;Comments&amp;gt;
        &amp;lt;p/&amp;gt;Value 2:
        &amp;lt;ul&amp;gt;
           &amp;lt;li&amp;gt;Value 2a&amp;lt;/li&amp;gt;
           &amp;lt;li&amp;gt;Value 2b&amp;lt;/li&amp;gt;
        &amp;lt;/ul&amp;gt;
    &amp;lt;/Comments&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am trying to make a field called &lt;EM&gt;Comments&lt;/EM&gt; with all the text inside the Comments tag for each Field tag. &lt;BR /&gt;
Example:&lt;BR /&gt;
For Name1, Comments="Value 1"&lt;BR /&gt;
For Name2, Comments="Value 2: Value 2a Value2b&lt;/P&gt;

&lt;P&gt;In the case of Name2, how do I capture the list as well as the paragraph?&lt;/P&gt;

&lt;P&gt;I have tried spath path=...Field.Comments but that only captures the &lt;CODE&gt;&amp;lt;p&amp;gt;&lt;/CODE&gt; .&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2018 18:54:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-all-children-in-xml/m-p/319576#M59684</guid>
      <dc:creator>matstap</dc:creator>
      <dc:date>2018-01-18T18:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract all children in xml?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-all-children-in-xml/m-p/319577#M59685</link>
      <description>&lt;P&gt;have you tried xpath instead?&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Xpath"&gt;https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Xpath&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;it still might be tricky to get all of them under comments, but what if you just tried &lt;CODE&gt;|xpath outfield=Comments "//Field/Comments"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2018 14:39:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-all-children-in-xml/m-p/319577#M59685</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-01-19T14:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract all children in xml?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-all-children-in-xml/m-p/319578#M59686</link>
      <description>&lt;P&gt;Thanks. That worked to capture everything inside the Comments. I then removed the tags to get my desired result:   &lt;CODE&gt;| rex field=Comments mode=sed "s/\&amp;lt;((\w|\/)+)\&amp;gt;//g"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2018 18:40:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-all-children-in-xml/m-p/319578#M59686</guid>
      <dc:creator>matstap</dc:creator>
      <dc:date>2018-01-19T18:40:27Z</dc:date>
    </item>
  </channel>
</rss>

