Answers.Body: <p>Here's the final solution in case anyone else comes across this post. 
  It is a specific use-case answer.</p>
  
  <pre><code>{% set feedParams = {
    url: 'https://yoursite.com/folder/ReleaseNotes.xml',
    type: 'xml',
    element: 'chapter',
    cache: 60,
  } %}
  
  {% set chapters = craft.feedme.feed(feedParams) %}
  
  {% for chapter in chapters %}
    &lt;h4 style="color:#0096dc;"&gt;&lt;strong&gt;{{ chapter.title }}&lt;/strong&gt;&lt;/h4&gt;
    &lt;hr&gt;
    {% if chapter.sect1.title is defined %} {# There's only one sect1 within this chapter node #}
      {{ _self.level1(chapter.sect1) }}
    {% elseif chapter.sect1 is defined %}
      {% for sect in chapter.sect1 %}
        {{ _self.level1(sect) }}
        &lt;p&gt;&amp;nbsp;&lt;/p&gt;
      {% endfor %}
    {% endif %}
  {% endfor %}
  
  
  {% macro level1(section) %}
    &lt;h5 style="margin-bottom:1rem;"&gt;&lt;strong&gt;{{ section.title }}&lt;/strong&gt;&lt;/h5&gt;
    {% if section.sect2.title is defined %} {# There's only one sect2 within this sect1 node #}
      {{ _self.level2(section.sect2) }}
    {% elseif section.sect2 is defined %}
      {% for subsection in section.sect2 %}
        {{ _self.level2(subsection) }}
      {% endfor %}
    {% endif %}
  {% endmacro %}
  
  
  {% macro level2(subsection) %}
    &lt;p style="color:;"&gt;&lt;strong&gt;&lt;i&gt;{{ subsection.title }}&lt;/i&gt;&lt;/strong&gt;&lt;/p&gt;
    {% if subsection.itemizedlist.listitem.para is defined %}
      {{ _self.level3(subsection.itemizedlist.listitem) }}
    {% elseif subsection.itemizedlist.listitem is defined %}
      {% for item in subsection.itemizedlist.listitem %}
        {{ _self.level3(item) }}
      {% endfor %}
    {% endif %}
  {% endmacro %}
  
  
  {% macro level3(item) %}
    &lt;p style="padding-left:15px;"&gt;{{ item.para }}&lt;/p&gt;
  {% endmacro %}
  </code></pre>
  
  <p>Thanks to @KSP and to @Evan Warner on Craft Discord for the final answer.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-11T00:37:18.940Z
Answers.LastActivityDate: 2020-06-11T00:37:18.940Z
Answers.UserDisplayName: xenowebdev
Answers.Body: <p>I think your problem is that <code>&lt;listitem xml:id="A50-3487-2"&gt;</code> has an attribute, so you would need to use <code>&lt;p&gt;{{ node.itemizedlist.listitem['@'].para }}&lt;/p&gt;</code> to get the node value.</p>
  
  <p>See the bottom of the docs here:
  <a href="https://docs.craftcms.com/feed-me/v4/feature-tour/using-in-your-templates.html" rel="nofollow noreferrer">https://docs.craftcms.com/feed-me/v4/feature-tour/using-in-your-templates.html</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-28T21:19:07.007Z
Answers.Text: Thanks, I tried that after finding those docs but I get a runtime error: Key "@" for array with keys "0, 1" does not exist. Still not sure what's going on
Answers.UserDisplayName: xenowebdev
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-29T13:10:21.703Z
Answers.Text: Ah! I think the issue rather is that you need to loop over the `itemizedlist` as it’s an array of `listitem`s. So it’s for instance `node.itemizedlist[0].listitem.para` should probably work!
Answers.UserDisplayName: KSP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-28T14:17:05.043Z
Answers.LastActivityDate: 2020-02-28T14:17:05.043Z
Answers.UserDisplayName: KSP
Body: <p>I'm importing data from an XML file.
  I'm having trouble accessing some of the deeper nodes in the xml file.</p>
  
  <p>Example of my xml here (chapter being the repeating item):</p>
  
  <pre><code>&lt;article xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en" class="techreport"&gt;
  
  &lt;chapter&gt;
  &lt;title&gt; Title – Version 5.0.11.110 &lt;/title&gt;
  &lt;subtitle&gt; Release Notes &lt;/subtitle&gt;
  &lt;info&gt;...&lt;/info&gt;
  &lt;sect1&gt;
  &lt;title&gt; Improvement &lt;/title&gt;
  &lt;sect2&gt;
  &lt;title&gt; AP - Accounts Payable &lt;/title&gt;
  &lt;itemizedlist&gt;
  &lt;listitem xml:id="A50-3451-1"&gt;
  &lt;para&gt;
  Allow edit for Shipment Comment on Both Shipments after Post Invoice if Edit Shipment After Posting is enabled.
  &lt;/para&gt;
  &lt;/listitem&gt;
  &lt;listitem xml:id="A50-3487-2"&gt;
  &lt;para&gt;
  Make AP Generate Payment form and report all fields from AP Transaction.
  &lt;/para&gt;
  &lt;/listitem&gt;
  &lt;/itemizedlist&gt;
  &lt;/sect2&gt;
  &lt;sect2&gt;
  &lt;title&gt; CB - Cash Book &lt;/title&gt;
  &lt;itemizedlist&gt;
  &lt;listitem xml:id="A50-3314-3"&gt;
  &lt;para&gt;
  Added StatementID, StatementLineNo and PeriodReconciled as available fields for the transactions band on the CB Unreconciled Transactions layout, making it easy to see if a transaction which is unreconciled as at the period reported on is on a statement, and reconciled subsequently.
  &lt;/para&gt;
  &lt;/listitem&gt;
  &lt;/itemizedlist&gt;
  &lt;/sect2&gt;
  &lt;/sect1&gt;
  &lt;sect1&gt;
  &lt;title&gt; Bug Fix &lt;/title&gt;
  &lt;sect2&gt;
  &lt;title&gt; ALL - All Modules &lt;/title&gt;
  &lt;itemizedlist&gt;
  &lt;listitem xml:id="A50-3400-1"&gt;
  &lt;para&gt;
  Fix possible A record already exists with that Layout (..) code - Error message.
  &lt;/para&gt;
  &lt;/listitem&gt;
  &lt;/itemizedlist&gt;
  &lt;/sect2&gt;
  &lt;/sect1&gt;
  &lt;/chapter&gt;
  
  &lt;/article&gt;
  </code></pre>
  
  <p>And my template code so far:</p>
  
  <pre><code>{% set params0 = {
      url: 'https://sitename/downloads/ReleaseNotes.xml',
      type: 'xml',
      element: 'chapter',
      cache: 60,
  } %}
  
  {% set params1 = {
      url: 'https://sitename/downloads/ReleaseNotes.xml',
      type: 'xml',
      element: 'sect1',
      cache: 60,
  } %}
  
  {% set params2 = {
      url: 'https://sitename/downloads/ReleaseNotes.xml',
      type: 'xml',
      element: 'sect2',
      cache: 60,
  } %}
  
  
  {% set feed0 = craft.feedme.feed(params0) %}
  {% set feed1 = craft.feedme.feed(params1) %}
  {% set feed2 = craft.feedme.feed(params2) %}
  
  {% for node in feed0 %}
      &lt;h4&gt;&lt;strong&gt;{{ node.title }}&lt;/strong&gt;&lt;/h4&gt;
  
      {% for node in feed1 %}
          &lt;p&gt;{{ node.title }}&lt;/p&gt;
  
          {% for node in feed2 %}
              &lt;p&gt;{{ node.title }}&lt;/p&gt;
              &lt;p&gt;{{ node.itemizedlist.listitem.para }}&lt;/p&gt;
          {% endfor %}
  
      {% endfor %}
  
  {% endfor %}
  </code></pre>
  
  <p>I've ended up using multiple feeds as I couldn't get to the "para" node at all. This maybe wrong.
  I thought that <code>&lt;p&gt;{{ node.itemizedlist.listitem.para }}&lt;/p&gt;</code> would do the trick.
  Can someone offer some help please.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-09T13:22:06.170Z
Comments.Text: @KSP If you use this `node.itemizedlist[0].listitem.para` you will only get the first item :)
Comments.UserDisplayName: Dennisvdw
Tags: <craft3><xml>
Title: Craft 3 FeedMe - Help accessing deeper XML nodes
ThreadText: # Craft 3 FeedMe - Help accessing deeper XML nodes
  
  (Asked by: username_0 on 2020-02-28)
  
  I'm importing data from an XML file.
  I'm having trouble accessing some of the deeper nodes in the xml file.
  
  Example of my xml here (chapter being the repeating item):
  
  ```
  <article xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en" class="techreport">
  
  <chapter>
  <title> Title – Version 5.0.11.110 </title>
  <subtitle> Release Notes </subtitle>
  <info>...</info>
  <sect1>
  <title> Improvement </title>
  <sect2>
  <title> AP - Accounts Payable </title>
  <itemizedlist>
  <listitem xml:id="A50-3451-1">
  <para>
  Allow edit for Shipment Comment on Both Shipments after Post Invoice if Edit Shipment After Posting is enabled.
  </para>
  </listitem>
  <listitem xml:id="A50-3487-2">
  <para>
  Make AP Generate Payment form and report all fields from AP Transaction.
  </para>
  </listitem>
  </itemizedlist>
  </sect2>
  <sect2>
  <title> CB - Cash Book </title>
  <itemizedlist>
  <listitem xml:id="A50-3314-3">
  <para>
  Added StatementID, StatementLineNo and PeriodReconciled as available fields for the transactions band on the CB Unreconciled Transactions layout, making it easy to see if a transaction which is unreconciled as at the period reported on is on a statement, and reconciled subsequently.
  </para>
  </listitem>
  </itemizedlist>
  </sect2>
  </sect1>
  <sect1>
  <title> Bug Fix </title>
  <sect2>
  <title> ALL - All Modules </title>
  <itemizedlist>
  <listitem xml:id="A50-3400-1">
  <para>
  Fix possible A record already exists with that Layout (..) code - Error message.
  </para>
  </listitem>
  </itemizedlist>
  </sect2>
  </sect1>
  </chapter>
  
  </article>
  
  ```
  
  And my template code so far:
  
  ```
  {% set params0 = {
      url: 'https://sitename/downloads/ReleaseNotes.xml',
      type: 'xml',
      element: 'chapter',
      cache: 60,
  } %}
  
  {% set params1 = {
      url: 'https://sitename/downloads/ReleaseNotes.xml',
      type: 'xml',
      element: 'sect1',
      cache: 60,
  } %}
  
  {% set params2 = {
      url: 'https://sitename/downloads/ReleaseNotes.xml',
      type: 'xml',
      element: 'sect2',
      cache: 60,
  } %}
  
  {% set feed0 = craft.feedme.feed(params0) %}
  {% set feed1 = craft.feedme.feed(params1) %}
  {% set feed2 = craft.feedme.feed(params2) %}
  
  {% for node in feed0 %}
      <h4><strong>{{ node.title }}</strong></h4>
  
      {% for node in feed1 %}
          <p>{{ node.title }}</p>
  
          {% for node in feed2 %}
              <p>{{ node.title }}</p>
              <p>{{ node.itemizedlist.listitem.para }}</p>
          {% endfor %}
  
      {% endfor %}
  
  {% endfor %}
  
  ```
  
  I've ended up using multiple feeds as I couldn't get to the "para" node at all. This maybe wrong.
  I thought that `<p>{{ node.itemizedlist.listitem.para }}</p>` would do the trick.
  Can someone offer some help please.
  
  **Tags:** craft3, xml
  
  > **Comments:**
  > **username_1**: @username_2 If you use this `node.itemizedlist[0].listitem.para` you will only get the first item :)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2020-06-11. Score: 0 | Accepted answer
  
  Here's the final solution in case anyone else comes across this post.
  It is a specific use-case answer.
  
  ```
  {% set feedParams = {
    url: 'https://yoursite.com/folder/ReleaseNotes.xml',
    type: 'xml',
    element: 'chapter',
    cache: 60,
  } %}
  
  {% set chapters = craft.feedme.feed(feedParams) %}
  
  {% for chapter in chapters %}
    <h4 style="color:#0096dc;"><strong>{{ chapter.title }}</strong></h4>
    <hr>
    {% if chapter.sect1.title is defined %} {# There's only one sect1 within this chapter node #}
      {{ _self.level1(chapter.sect1) }}
    {% elseif chapter.sect1 is defined %}
      {% for sect in chapter.sect1 %}
        {{ _self.level1(sect) }}
        <p>&nbsp;</p>
      {% endfor %}
    {% endif %}
  {% endfor %}
  
  {% macro level1(section) %}
    <h5 style="margin-bottom:1rem;"><strong>{{ section.title }}</strong></h5>
    {% if section.sect2.title is defined %} {# There's only one sect2 within this sect1 node #}
      {{ _self.level2(section.sect2) }}
    {% elseif section.sect2 is defined %}
      {% for subsection in section.sect2 %}
        {{ _self.level2(subsection) }}
      {% endfor %}
    {% endif %}
  {% endmacro %}
  
  {% macro level2(subsection) %}
    <p style="color:;"><strong><i>{{ subsection.title }}</i></strong></p>
    {% if subsection.itemizedlist.listitem.para is defined %}
      {{ _self.level3(subsection.itemizedlist.listitem) }}
    {% elseif subsection.itemizedlist.listitem is defined %}
      {% for item in subsection.itemizedlist.listitem %}
        {{ _self.level3(item) }}
      {% endfor %}
    {% endif %}
  {% endmacro %}
  
  {% macro level3(item) %}
    <p style="padding-left:15px;">{{ item.para }}</p>
  {% endmacro %}
  
  ```
  
  Thanks to @username_2 and to @Evan Warner on Craft Discord for the final answer.
  
  
  ---
  
  ### Answer by username_2 on 2020-02-28. Score: 1
  
  I think your problem is that `<listitem xml:id="A50-3487-2">` has an attribute, so you would need to use `<p>{{ node.itemizedlist.listitem['@'].para }}</p>` to get the node value.
  
  See the bottom of the docs here:
  <https://docs.craftcms.com/feed-me/v4/feature-tour/using-in-your-templates.html>
  
  > **Comments:**
  > **username_0**: Thanks, I tried that after finding those docs but I get a runtime error: Key "@" for array with keys "0, 1" does not exist. Still not sure what's going on  
  > **username_2**: Ah! I think the issue rather is that you need to loop over the `itemizedlist` as it’s an array of `listitem`s. So it’s for instance `node.itemizedlist[0].listitem.para` should probably work!  
  
  ---
  
  