Skip to content
Reference > Classes

XmlElement

Definition

XmlElement var = .... ;

Extends

Extended By

None

Description

Element for XML

Method Summary

Owner Name Return Type Description
XmlElement constructor(xmlString) XmlElement Creates an XML Element from an XML String
XmlElement addAttribute(key, value) XmlElement Add an attribute to the XmlElement corresponding to the key-value pair
XmlElement addAttribute(key, value) XmlElement Add an attribute to the XmlElement corresponding to the key-value pair
XmlElement addAttribute(key, value) XmlElement Add an attribute to the XmlElement corresponding to the key-value pair
XmlElement addChild(XmlNode) XmlElement Add an XmlNode - element or text - to an XmlElement
XmlElement addNode(XmlText) XmlElement Add an existing XmlText node to the XmlElement
XmlElement getAttribute(name) String Gets the attribute specified by a name
XmlElement getAttributes() Map Returns any attributes of the current element
XmlElement getChildren() List Get a list of the XmlElement's children
Object getClassName() String Returns the string name of this object's class type.
XmlElement getElements() List Returns any elements within the current element
XmlElement getElements(name) List Returns any elements within the current element based on the name specified
XmlElement getFirstElement(name) XmlElement Returns the first element with the specified name
XmlElement getInnerAsString() String Returns inner value of element as string
XmlElement getName() String Returns tag name of current element
XmlElement hasAttribute(key) String Check if the XmlElement contains an attribute based on the entered key
XmlElement removeAttribute(name) XmlElement Remove an attribute based on the attribute name entered
Object toJson() String Returns a json representation of this object.
XmlElement toLegibleString() String Returns the XmlElement as a legible string
XmlElement toString() String Returns the XmlElement as a string

Method Definitions


constructor(xmlString)

XmlElement xmlelement = new XmlElement(String xmlString)

Description

Creates an XML Element from an XML String

Parameter Definition

Name Type Description
xmlString String  xmlString to create the XmlElement

addAttribute(key,value)

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

Description

Add an attribute to the XmlElement corresponding to the key-value pair

Parameter Definition

Name Type Description
key String  key corresponding to the key
value String  value the key will have

addAttribute(key,value)

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

Description

Add an attribute to the XmlElement corresponding to the key-value pair

Parameter Definition

Name Type Description
key String  key corresponding to the key
value Long  value the key will have

addAttribute(key,value)

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

Description

Add an attribute to the XmlElement corresponding to the key-value pair

Parameter Definition

Name Type Description
key String  key corresponding to the key
value Double  value the key will have

addChild(XmlNode)

XmlElement XmlElement::addChild(Object XmlNode)

Description

Add an XmlNode - element or text - to an XmlElement

Parameter Definition

Name Type Description
XmlNode Object  XmlNode node to be added

addNode(XmlText)

XmlElement XmlElement::addNode(XmlText XmlText)

Description

Add an existing XmlText node to the XmlElement

Parameter Definition

Name Type Description
XmlText XmlText  XmlText node to be added

getAttribute(name)

String XmlElement::getAttribute(String name)

Description

Gets the attribute specified by a name

Parameter Definition

Name Type Description
name String  Name the attribute should match

getAttributes()

Map XmlElement::getAttributes()

Description

Returns any attributes of the current element


getChildren()

List XmlElement::getChildren()

Description

Get a list of the XmlElement's children


getElements()

List XmlElement::getElements()

Description

Returns any elements within the current element


getElements(name)

List XmlElement::getElements(String name)

Description

Returns any elements within the current element based on the name specified

Parameter Definition

Name Type Description
name String  Name the elements should match

getFirstElement(name)

XmlElement XmlElement::getFirstElement(String name)

Description

Returns the first element with the specified name

Parameter Definition

Name Type Description
name String  Name the element should match

getInnerAsString()

String XmlElement::getInnerAsString()

Description

Returns inner value of element as string


getName()

String XmlElement::getName()

Description

Returns tag name of current element


hasAttribute(key)

String XmlElement::hasAttribute(String key)

Description

Check if the XmlElement contains an attribute based on the entered key

Parameter Definition

Name Type Description
key String  Key that the attribute should have

removeAttribute(name)

XmlElement XmlElement::removeAttribute(String name)

Description

Remove an attribute based on the attribute name entered

Parameter Definition

Name Type Description
name String  Name that should match the attribute to remove

toLegibleString()

String XmlElement::toLegibleString()

Description

Returns the XmlElement as a legible string


toString()

String XmlElement::toString()

Description

Returns the XmlElement as a string