new YXmlElement()
Methods
-
delete(index, lengthopt)
-
Deletes elements starting from an index.
Parameters:
Name Type Attributes Default Description indexnumber Index at which to start deleting elements
lengthnumber <optional>
1 The number of elements to remove. Defaults to 1.
-
getAttribute(attributeName) → {String}
-
Returns an attribute value that belongs to the attribute name.
Parameters:
Name Type Description attributeNameString The attribute name that identifies the queried value.
Returns:
String -The queried attribute value.
-
getAttributes(snapshotopt) → {Object}
-
Returns all attribute name/value pairs in a JSON Object.
Parameters:
Name Type Attributes Description snapshotSnapshot <optional>
Returns:
Object -A JSON Object that describes the attributes.
-
insert(index, content)
-
Inserts new content at an index.
Parameters:
Name Type Description indexnumber The index to insert content at
contentArray.<(YXmlElement|YXmlText)> The array of content
Example
// Insert character 'a' at position 0 xml.insert(0, [new Y.XmlText('text')]) -
removeAttribute(attributeName)
-
Removes an attribute from this YXmlElement.
Parameters:
Name Type Description attributeNameString The attribute name that is to be removed.
-
setAttribute(attributeName, attributeValue)
-
Sets or updates an attribute.
Parameters:
Name Type Description attributeNameString The attribute name that is to be set.
attributeValueString The attribute value that is to be set.
-
toDom(_documentopt, hooksopt, bindingopt) → {Node}
-
Creates a Dom Element that mirrors this YXmlElement.
Parameters:
Name Type Attributes Default Description _documentDocument <optional>
document The document object (you must define this when calling this method in nodejs)
hooksObject.<string, any> <optional>
{} Optional property to customize how hooks are presented in the DOM
bindingany <optional>
You should not set this property. This is used if DomBinding wants to create a association to the created DOM type.
-
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.