Skip to content
Reference > Classes

XmlBuilder

Definition

XmlBuilder var = .... ;

Extends

Extended By

None

Description

Builder for XML

Method Summary

Owner Name Return Type Description
XmlBuilder constructor() XmlBuilder Creates a XmlBuilder
XmlBuilder constructor(XmlElement) XmlBuilder Creates a XmlBuilder and initializes with an existing xml
XmlBuilder addAttribute(attributes) XmlBuilder Adds attributes to XmlBuilder based on provided map
XmlBuilder addAttribute(key, value) XmlBuilder Adds attributes to XmlBuilder based on key, value provided
XmlBuilder addAttribute(key, value) XmlBuilder Adds attributes to XmlBuilder based on key, value provided
XmlBuilder addAttribute(key, value) XmlBuilder Adds attributes to XmlBuilder based on key, value provided
XmlBuilder addElement(xmlElement) XmlBuilder Adds XmlElement in XmlBuilder
XmlBuilder addElement(elementName) XmlBuilder Adds element to element in XmlBuilder using
XmlBuilder addNode(nodeName) XmlBuilder Adds a new node with provided name
XmlBuilder addText(text) XmlBuilder Adds text to XmlBuilder
XmlBuilder addTextElement(name, text) XmlBuilder Adds text to element in XmlBuilder
XmlBuilder build() Object Builds XML
XmlBuilder buildAndClear() Object Builds and clears XML
XmlBuilder clear() XmlBuilder Clears the XmlBuilder
XmlBuilder csize() Integer Returns the current element's size in XmlBuilder.
Returns -1 if XmlBuilder is not a list
XmlBuilder ctype() Object Returns the current element's type in XmlBuilder
XmlBuilder current() Object Returns current element
XmlBuilder elements() XmlBuilder Walk Elements
XmlBuilder elements(name) XmlBuilder Walk Elements with provided name
XmlBuilder enter() XmlBuilder Enter into the element that was last added
XmlBuilder first() XmlBuilder Returns the first elements
Object getClassName() String Returns the string name of this object's class type.
XmlBuilder init(XmlElement) XmlBuilder Initializes the XmlBuilder with an existing XML node
XmlBuilder lastAdd() Object Returns last added xml node
XmlBuilder nodes() XmlBuilder Walk Nodes
XmlBuilder pop() XmlBuilder Pops a XML element from the builder
XmlBuilder popNode() XmlBuilder Pops the latest node from the XmlBuilder
XmlBuilder reset() XmlBuilder Resets the XmlBuilder
Object toJson() String Returns a json representation of this object.
XmlBuilder toString(xmlElement) XmlBuilder Stringifies xmlElement
XmlBuilder toString(stringBuilder, xmlElement) XmlBuilder Stringifies xmlElement
XmlBuilder walk(name) XmlBuilder Walk Elements
XmlBuilder walk(stops) XmlBuilder Walk Elements
XmlBuilder walk(pos) XmlBuilder Walk Elements

Method Definitions


constructor()

XmlBuilder xmlbuilder = new XmlBuilder()

Description

Creates a XmlBuilder


constructor(XmlElement)

XmlBuilder xmlbuilder = new XmlBuilder(Object XmlElement)

Description

Creates a XmlBuilder and initializes with an existing xml

Parameter Definition

Name Type Description
XmlElement Object  Stringified XML

addAttribute(attributes)

XmlBuilder XmlBuilder::addAttribute(Map attributes)

Description

Adds attributes to XmlBuilder based on provided map

Parameter Definition

Name Type Description
attributes Map  Map of attributes of xml elements

addAttribute(key,value)

XmlBuilder XmlBuilder::addAttribute(String key, String value)

Description

Adds attributes to XmlBuilder based on key, value provided

Parameter Definition

Name Type Description
key String  key of the xml element
value String  value of the xml element

addAttribute(key,value)

XmlBuilder XmlBuilder::addAttribute(String key, Long value)

Description

Adds attributes to XmlBuilder based on key, value provided

Parameter Definition

Name Type Description
key String  key of the xml element
value Long  value of the xml element

addAttribute(key,value)

XmlBuilder XmlBuilder::addAttribute(String key, Double value)

Description

Adds attributes to XmlBuilder based on key, value provided

Parameter Definition

Name Type Description
key String  key of the xml element
value Double  value of the xml element

addElement(xmlElement)

XmlBuilder XmlBuilder::addElement(XmlElement xmlElement)

Description

Adds XmlElement in XmlBuilder

Parameter Definition

Name Type Description
xmlElement XmlElement  XML element to be added to the XmlBuilder

addElement(elementName)

XmlBuilder XmlBuilder::addElement(String elementName)

Description

Adds element to element in XmlBuilder using

Parameter Definition

Name Type Description
elementName String  Name of element to be added to the XmlBuilder

addNode(nodeName)

XmlBuilder XmlBuilder::addNode(Object nodeName)

Description

Adds a new node with provided name

Parameter Definition

Name Type Description
nodeName Object  name of xml node to be added into the XmlBuilder

addText(text)

XmlBuilder XmlBuilder::addText(String text)

Description

Adds text to XmlBuilder

Parameter Definition

Name Type Description
text String  Text to append to the XmlBuilder

addTextElement(name,text)

XmlBuilder XmlBuilder::addTextElement(String name, String text)

Description

Adds text to element in XmlBuilder

Parameter Definition

Name Type Description
name String  Alias of element
text String  Text to add to the XmlBuilder

build()

Object XmlBuilder::build()

Description

Builds XML


buildAndClear()

Object XmlBuilder::buildAndClear()

Description

Builds and clears XML


clear()

XmlBuilder XmlBuilder::clear()

Description

Clears the XmlBuilder


csize()

Integer XmlBuilder::csize()

Description

Returns the current element's size in XmlBuilder.
Returns -1 if XmlBuilder is not a list


ctype()

Object XmlBuilder::ctype()

Description

Returns the current element's type in XmlBuilder


current()

Object XmlBuilder::current()

Description

Returns current element


elements()

XmlBuilder XmlBuilder::elements()

Description

Walk Elements


elements(name)

XmlBuilder XmlBuilder::elements(String name)

Description

Walk Elements with provided name

Parameter Definition

Name Type Description
name String  XML element name

enter()

XmlBuilder XmlBuilder::enter()

Description

Enter into the element that was last added


first()

XmlBuilder XmlBuilder::first()

Description

Returns the first elements


init(XmlElement)

XmlBuilder XmlBuilder::init(Object XmlElement)

Description

Initializes the XmlBuilder with an existing XML node

Parameter Definition

Name Type Description
XmlElement Object  Stringified XML

lastAdd()

Object XmlBuilder::lastAdd()

Description

Returns last added xml node


nodes()

XmlBuilder XmlBuilder::nodes()

Description

Walk Nodes


pop()

XmlBuilder XmlBuilder::pop()

Description

Pops a XML element from the builder


popNode()

XmlBuilder XmlBuilder::popNode()

Description

Pops the latest node from the XmlBuilder


reset()

XmlBuilder XmlBuilder::reset()

Description

Resets the XmlBuilder


toString(xmlElement)

XmlBuilder XmlBuilder::toString(Object xmlElement)

Description

Stringifies xmlElement

Parameter Definition

Name Type Description
xmlElement Object  xmlElement to stringify

toString(stringBuilder,xmlElement)

XmlBuilder XmlBuilder::toString(StringBuilder stringBuilder, Object xmlElement)

Description

Stringifies xmlElement

Parameter Definition

Name Type Description
stringBuilder StringBuilder  Stringbuilder to append to
xmlElement Object  xmlElement to stringify

walk(name)

XmlBuilder XmlBuilder::walk(String name)

Description

Walk Elements

Parameter Definition

Name Type Description
name String  XML element name

walk(stops)

XmlBuilder XmlBuilder::walk(Object ... stops)

Description

Walk Elements

Parameter Definition

Name Type Description
stops Object ...  Expects stops to be strings or integers.

walk(pos)

XmlBuilder XmlBuilder::walk(Integer pos)

Description

Walk Elements

Parameter Definition

Name Type Description
pos Integer  Position of the XML element