<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>

CC BY-SA 4.0
2020-06-11T00:37:18.940Z
2020-06-11T00:37:18.940Z
xenowebdev
<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>

CC BY-SA 4.0
2020-02-28T21:19:07.007Z
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
xenowebdev
CC BY-SA 4.0
2020-02-29T13:10:21.703Z
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!
KSP
CC BY-SA 4.0
2020-02-28T14:17:05.043Z
2020-02-28T14:17:05.043Z
KSP
<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>

CC BY-SA 4.0
2020-06-09T13:22:06.170Z
@KSP If you use this `node.itemizedlist[0].listitem.para` you will only get the first item :)
Dennisvdw
<craft3><xml>
Craft 3 FeedMe - Help accessing deeper XML nodes
# 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):



 Title – Version 5.0.11.110 
 Release Notes 
...

 Improvement 

 AP - Accounts Payable 



Allow edit for Shipment Comment on Both Shipments after Post Invoice if Edit Shipment After Posting is enabled.




Make AP Generate Payment form and report all fields from AP Transaction.





 CB - Cash Book 



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.






 Bug Fix 

 ALL - All Modules 



Fix possible A record already exists with that Layout (..) code - Error message.









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 %}
    {{ node.title }}

    {% for node in feed1 %}
        {{ node.title }}

        {% for node in feed2 %}
            {{ node.title }}
            {{ node.itemizedlist.listitem.para }}
        {% 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 {{ node.itemizedlist.listitem.para }} 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 %}
  {{ chapter.title }}
  
  {% 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) }}
       
    {% endfor %}
  {% endif %}
{% endfor %}


{% macro level1(section) %}
  {{ section.title }}
  {% 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) %}
  {{ subsection.title }}
  {% 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) %}
  {{ item.para }}
{% 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  has an attribute, so you would need to use `{{ node.itemizedlist.listitem['@'].para }}` 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!  

---

