My Xml looks like:
<examplexml>
<nest1>
<nest2>
<nest3>
<mean>5</mean>
<stdeviation>0.1</stdeviation>
</nest3>
</nest2>
</nest1>
<nest1>
<nest2>
<nest3>
<mean>7</mean>
<stdeviation>0.2</stdeviation>
</nest3>
</nest2>
</nest1>
</examplexml>
I'm stuck using Liquid on this project and I want to parse this xml. I can get the mean once by doing
{{ file.parse.examplexml.nest1.nest2.nest3.mean }}
but I want to get all the means, so I thought I could do
{% for nest1 in file.parse.examplexml.nest1 %}
{{ nest1.nest2.nest3.mean }}
{% endfor %}
But this prints out nothing. However if I do
{% for nest1 in file.parse.examplexml.nest1 %}
{{ nest1 }}
{% endfor %}
I get nest2. So I'd think I can access the mean through the nest2 and nest3 properties, but it doesn't seem to work that way afaik. Is there a way to do this in Liquid? Thanks.
No comments:
Post a Comment