org.springframework.roo.support.util
Class XmlElementBuilder

java.lang.Object
  extended by org.springframework.roo.support.util.XmlElementBuilder

public class XmlElementBuilder
extends Object

Very simple convenience Builder for XML Elements

Since:
1.0
Author:
Stefan Schmidt

Constructor Summary
XmlElementBuilder(String name, Document document)
          Create a new Element instance.
 
Method Summary
 XmlElementBuilder addAttribute(String qName, String value)
          Add an attribute to the current element.
 XmlElementBuilder addChild(Node node)
          Add a child node to the current element.
 Element build()
          Get the element instance.
 XmlElementBuilder setText(String text)
          Add text contents to the current element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlElementBuilder

public XmlElementBuilder(String name,
                         Document document)
Create a new Element instance.

Parameters:
name - The name of the element (required, not empty)
document - The parent document (required)
Method Detail

addAttribute

public XmlElementBuilder addAttribute(String qName,
                                      String value)
Add an attribute to the current element.

Parameters:
qName - The attribute name (required, not empty)
value - The value of the attribute (required)
Returns:

addChild

public XmlElementBuilder addChild(Node node)
Add a child node to the current element.

Parameters:
node - The new node (required)
Returns:
The builder for the current element

setText

public XmlElementBuilder setText(String text)
Add text contents to the current element. This will overwrite any previous text content.

Parameters:
element - The text content (required, not empty)
Returns:
The builder for the current element

build

public Element build()
Get the element instance.

Returns:
The element.


Copyright © 2009-2010 VMware, Inc. All Rights Reserved.