Xinf API Reference
Back | Index
class xinf.xml.Node
implements Serializable

A generic Node, as in an XML document, but also the base class for all xinf's SVG-like Elements.

While this is oriented on the SVG uDOM, there are some differences. There is currently no namespace support; parentNode is parentElement here; xinf currently doesn't support any other node types than Element, and there is no textContent.

This might change when xinf supports (re-)serialization of XML content. The Interface described here should stay the same.

See also: Node in SVG uDOM

var parentElement :XMLElement (read-only)
The parent Element of this Node, if the Node is attached.
var ownerDocument :Document (read-only)
The Document that ultimately contains this Node. In Xinf, there is currently only one document. See Root. A node is always associated to a Document.
var childNodes :Iterator<Node> (read-only)
An iterator of the child Nodes contained in this Node.
function new( ) :Void

Create a new, empty Node.

FIXME: should be associated to the root document?

function fromXml( xml:Xml ) :Void

De-serialize the node content and attributes from the given Xml.

You'll usually not call this. Instead, use Document.instantiate or .load.

function onLoad( ) :Void

Called after the Document has been fully loaded (not including external references like images) and the Node structure is set up. Provides a hook for deriving classes to initialize things that depend on the document structure to be fully set up.

This also calls onLoad on any child nodes.

function appendChild( newChild:Node ) :Node
Appendsthe Node newChild to the end of the list of children of this node.
function insertBefore( newChild:Node, refChild:Node ) :Node
Insertsthe Node newChild into the list of children of this node, immediately before refChild.
function removeChild( oldChild:Node ) :Node
Removesthe Node oldChild from the list of children.
function cloneNode( deep:Bool ) :Node
Creates a 1-to-1 clone of this Node. If deep is true, any children will be cloned, too. Else, the new Node is empty.
function getTypedParent<T>( type:Class<T> ) :T
Convenience function, return the parentElement of this Node typed to the class type, or null if the parent is not of that type.
function toString( ) :String
Create a human-readable String representation of this node, mostly for debugging purposes. The string will be the class name of this individual instance.
Back | Index