FreeMarker XML Attributes present leads to undefined

usmovie

New Member
So I've just started experimenting with FreeMarker and I've hit this problem.When I use online tutorials with the XML file supplied and write something like\[code\]${doc.book.chapter.para[0]}\[/code\]I get the expected output.However, when I try with my own XML document I get an error Expression.... is undefined.I think I've worked out that this is because my XML has attributes and the tutorial one does not.I've reached this conclusion because if I type\[code\]${doc.MyElement[0]} \[/code\]I get the undefined errorBut, if I remove the Attribute from the XML document, and type the same thing\[code\]${doc.MyElement[0]}\[/code\]I get a different error, to do with MyElement having Children. I obviously expected and understand the second error, but why does it change simply by removing the attribute? Surely these should just get ignored?Has anyone else had this problem? What's the solution?Thanks,BasilPS. Just to check I have the terminology right, when I say Attribute, I mean "book type = fiction" as opposed to just "book"
 
Back
Top