Banana.Xml.XmlElement

In diesem Artikel

The XmlElement class represents an Xml element. See Banana.Xml for an example.

Since: Banana Accounting 9.0.3

Properties

nodeName

The read only property nodeName returns the node name of the xml element.

parent

The read only property parent returns the parent of this Xml element as a Banana.Xml.XmlElment object. If this is the root element, it returns null.

text

The read only property text returns the text of this Xml element and their childs.

value

This is a synomin of the property text.

Methods

addProcessingInstruction(target, data)

Adds a new processing instruction to the document.

xmlDoc.addProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"');

Since Banana 9.0.4

addElement(name)

Adds a new Banana.Xml.XmlElement with the specified name to the document and returns it.

Since Banana 9.0.4

addElementNs(ns, name)

Adds a new Banana.Xml.XmlElement with the specified name and namespace to the document and returns it.

Since Banana 9.0.4

addComment(text)

Adds a comment note to the document, and returns it as a Banana.Xml.XmlElement object.

Since Banana 9.0.4

addTextNode(text)

Adds a new Xml TextNode to the document and returns it as a Banana.Xml.XmlElement object.

Since Banana 9.0.4

attibute(name [, defaultValue])

Returns the value of the attribute with the specified name as a string. If no attibute with the specified name is found, the defaultValue or an empty string is returned.

attibuteNS(ns, name [, defaultValue])

Returns the value of the attribute with the specified name and namespace as a string. If no attibute with the specified name is found, the defaultValue or an empty string is returned.

elementsByTagName(name)

Returns an array containing all descendants of this element with the specified name.

firstChildElement([name])

Returns the first child element with the specified name if name is non-empty, otherwise it returns the first child element. Returns null if no such child exists.

var bookNode = xmlRoot.firstChildElement('Book');  // First book
while (bookNode) { 
   // For each book in the library
   var title = xmlFile.firstChildElement('Title').text();
   bookNode = bookNode.nextSiblingElement('Book');  // Next book
} 

hasChildElements([name])

Returns true if this element contains one or mode elemets with the specified name.

hasAttribute(name)

Returns true is the attribute with the specified name exists.

hasAttributeNS(ns, name)

Returns true if the attribute with the specified name and namespace exists.

lastChildElement([name])

Returns the last child element with the specified name if name is non-empty, otherwise it returns the last child element. Returns null if no such child exists.

namespaceURI()

Returns the namespace URI of this node or an empty string if the node has no namespace URI.

Since Banana 9.0.4

nextSiblingElement([name])

Returns the next sibling element with the specified name if name is non-empty, otherwise returns any next sibling element. Returns null if no such sibling exists.

prefix()

Returns the namespace prefix of the node or an empty string if the node has no namespace prefix.

Since Banana 9.0.4

previousSiblingElement([name])

Returns the previous sibling element with the specified name if name is non-empty, otherwise returns any previous sibling element. Returns null if no such sibling exists.

setAttribute(name, value)

Adds an attribute with the qualified name name with the value value.

Since Banana 9.0.4

setAttributeNs(ns, name, value)

Adds an attribute with the qualified name name and the namespace URI ns with the value value.

Since Banana 9.0.4

setPrefix(value)

If the node has a namespace prefix, this function changes the namespace prefix of the node to pre. Otherwise this function does nothing.

Since Banana 9.0.4

Diese Dokumentation ist veraltet

Die umfangreichste und aktuellste Dokumentation ist die von Banana Buchhaltung Plus: Probieren Sie es sofort aus!

Diesen Artikel teilen: Twitter | Facebook | LinkedIn | Email