From: Marc P. <ma...@an...> - 2003-04-19 01:07:08
|
Hi all - hope you are having a nice Easter holiday, it sure is quiet around here :) I modelled my #macro stack overflow problem using purely #bean and #macro. StackOverflowError is the result, in build phase I think, rather than evaluation. This completely eliminates my XML helper class. The problem is WM or me misunderstanding the capabilities of #macro. I think this warrants pretty quick examination - I am certainly screwed without a fix for this and I would be really grateful if someone who actually understands the parse/build mechanisms can look at this. I sure as hell don't :( Here is the complete template, using simple recursion. : ## ******************************************************** ## This is all just to set up a trivial tree structure ## ******************************************************** #bean $rootNode = "java.util.Hashtable" #set $rootNode.Text="root" #bean $wmdocNode = "java.util.Hashtable" #set $wmdocNode.Text="wmdoc" #bean $titleNode1 = "java.util.Hashtable" #set $titleNode1.Text="title1" #bean $paraNode1 = "java.util.Hashtable" #set $paraNode1.Text="para1" #bean $titleNode2 = "java.util.Hashtable" #set $titleNode2.Text="title2" #bean $paraNode2 = "java.util.Hashtable" #set $paraNode2.Text="para2" #bean $paraNode3 = "java.util.Hashtable" #set $paraNode3.Text="para3" #set $rootNode.Children = [ $wmdocNode] #set $paraNode1.Children = [$titleNode2, $paraNode2] #set $wmdocNode.Children = [$titleNode1, $paraNode1, $paraNode3] ## ******************************************************** ## Here is the code ## ******************************************************** #macro visitChildren( $node) #foreach $n in $node.Children $n.Text<br> #visitChildren( $n) #end #end ## ******************************************************** ## Call the code ## ******************************************************** #visitChildren( $rootNode) -- Marc Palmer (Wangjammer5) http://www.wangjammers.org Java Consultants |