Hmm. Sounds less than ideal. I don't have time to improve how the XMLTool handles this, but if you're up for filing a bug and perhaps even contributing a patch, that'd be great. :)
On Wed, Oct 2, 2013 at 11:05 AM, Ralph Goers <ralph.go...@dslextreme.com> wrote: > I found that the problem isn't in the foreach. It is that when you do > > #foreach($row in $xml.details.row) > $row.item1 > #end > > It results in item1 printing the item1 value for all rows. This is because > get() calls find("item1") which then calls node.selectNodes() in dom4j. > dom4j returns all the the nodes. The only way I have found to fix this is to > do > > $row.find("./item1") > > This returns the value for only the current row. > > Ralph > > > On Oct 2, 2013, at 8:21 AM, Ralph Goers <ralph.go...@dslextreme.com> wrote: > >> I have an XML document of the form >> >> <data> >> <details> >> <row> >> <item1> >> <item2> >> </row> >> <row> >> <item1> >> <item2> >> </row> >> </details> >> </data> >> >> I cannot seem to find a way to successfully iterate over the row elements. >> For some reason the data from each of the rows is being co-mingled. Does >> anyone have an example of iterating over xml elements using the XMLTool? >> >> Ralph > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org > For additional commands, e-mail: user-h...@velocity.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org