jastrachan | 31 Mar 09:12 2004
Picon

Re: MarkupBuilder methods

The idea behind the markup builders are that the methods called on the 
builder creates a node using the parameters that are passed to it. So 
they are intended to be used in a GroovyMarkup kind of way...

builder.html {
     body {
	h1("header")
	p("Some text")
     }
}

etc

By all means try refactor the implementations to try do things you want 
to do - patches are most welcome. We can change the internals to fit 
different kinds of builders properly.  We could create a builder which 
talks to some kind of node factory, that you could use directly outside 
of the markup mechanism.

On 30 Mar 2004, at 16:06, Shakeel Mahate wrote:
> According to the Groovy JavaDoc, MarkupBuilder has the following 
> methods:
>
>  
>
> createNode(name)
>
> createNode(name, attributes)
>
> createNode(name, value)
>
> getName(methodName)
>
> nodeCompleted(parent, node)
>
> print(node)
>
> setParent(parent, child)
>
> transformName(name)
>
> transformValue(value)
>
>  
>
> All of the methods are protected, which only allows one hook to create 
> nodes, via method invocations on unimplemented methods.
>
>  
>
> I would like to see the createNode methods made public to allow 
> another mechanism to create nodes.
>
>  
>
> x = ‘NodeName’
>
> mb = new MarkupBuilder()
>
> mb.createNode(x, ‘Value’)
>
>  
>
> Currently I only have the following which isn’t the same as the above 
> code
>
> mb.NodeName(‘Value’)
>
>  
>
> Also, shouldn’t there exist MarkupBuilder.createNode(name, value, 
> attributes)
>
>  
>
> Shakeel
>

James
-------
http://radio.weblogs.com/0112098/

Gmane