You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Chris Bentley <be...@boogaloos.de> on 2005/01/25 21:02:35 UTC

Recursion in CForms


Well, I have been working with the brilliant cforms for a while, but 
now I am trying to do someting that is very natural in XML, but seems 
to be a serios problem in cforms, and that is quite simply a tree 
structure

Trying to something like this is really uncomfortable.

<tree>
	<treeNode>
		<treeNodeName>I am a node</treeNodeName>
		<treeNodeChildren>
			<treeNode>
				<treeNodeName>I am a node</treeNodeName>
				<treeNodeChildren>
					<treeNode>
						<treeNodeName>I am a 
node</treeNodeName>
						<treeNodeChildren/>
					</treeNode>
				</treeNodeChildren>
			</treeNode>
		</treeNodeChildren>
	</treeNode>
	<treeNode>
		<treeNodeName>I am a node</treeNodeName>
		<treeNodeChildren/>
	</treeNode>
</tree>

The natural thing would to define a definition like this:

<fd:form>
	<fd:widgets>
		<fd:new id="treeNode"/>
		<fd:class id="treeNode">
			<fd:widgets>
				<fd:struct id="treeNodeChildren">
					<fd:widgets>
						<fd:new id="treeNode"/>
					</fd:widgets>
				</fd:struct>
				<fd:field id="treeNodeName">
					<fd:datatype base="string"/>
					<fd:label>Tree Node 
Name</fd:label>
				</fd:field>
			</fd:widgets>
		</fd:class>
	</fd:widgets>
</fd:form>

However directing a fd:new "treeNode" within the fd:class "treeNode",
creates a recursion error. I can naturally understand that the developer
wanted to hinder an tree structure being huge in memory for no reason.

Does any one know how to do this using cforms in a reasonable way.

Thank You
Chris Bentley

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org