types.YXmlElement()

An YXmlElement imitates the behavior of a Dom Element.

  • An YXmlElement has attributes (key value pairs)
  • An YXmlElement has childElements that must inherit from YXmlElement

new YXmlElement()

Methods

getAttribute(attributeName) → {String}

Returns an attribute value that belongs to the attribute name.

Parameters:
Name Type Description
attributeName String

The attribute name that identifies the queried value.

Returns:
String -

The queried attribute value.

getAttributes() → {Object}

Returns all attribute name/value pairs in a JSON Object.

Returns:
Object -

A JSON Object that describes the attributes.

removeAttribute(attributeName)

Removes an attribute from this YXmlElement.

Parameters:
Name Type Description
attributeName String

The attribute name that is to be removed.

setAttribute(attributeName, attributeValue)

Sets or updates an attribute.

Parameters:
Name Type Description
attributeName String

The attribute name that is to be set.

attributeValue String

The attribute value that is to be set.

toDom(_documentopt, hooksopt, bindingopt) → {Element}

Creates a Dom Element that mirrors this YXmlElement.

Parameters:
Name Type Attributes Default Description
_document Document <optional>
document

The document object (you must define this when calling this method in nodejs)

hooks Object.<string, any> <optional>
{}

Optional property to customize how hooks are presented in the DOM

binding DomBinding <optional>

You should not set this property. This is used if DomBinding wants to create a association to the created DOM type.

Returns:
Element -

The Dom Element

toDomString() → {String}

Returns the string representation of this YXmlElement. The attributes are ordered by attribute-name, so you can easily use this method to compare YXmlElements

Returns:
String -

The string representation of this type.