class

KXML::Element

Inherits KXML::Node < Reference < Object

Constructors

new(name : String, prefix : String | Nil, local_name : String, namespace_uri : String | Nil, attributes : Array(Attribute))
Source

Class methods

next_clark_number
Source
parse_clark(name : String) : Tuple(String | Nil, String)

Splits a Clark-notation name into {uri, local}; nil uri for plain names.

Source

Instance methods

[](name : String) : String | Nil
Source
[]?(name : String) : String | Nil
Source
append_child(node : Node) : Node

Appends node as the last child (moving it out of any existing parent first - libxml2's xmlAddChild move semantics). Adjacent text nodes are coalesced, mirroring xmlAddChild, so a mutated document re-parses to the same tree it serializes to.

Source
attribute(name : String) : Attribute | Nil
Source
attribute_value(name : String) : String | Nil

Reads attribute name (Clark or plain).

Source
attributes
Source
children
Source
delete_attribute(name : String) : Nil

Removes attribute name (Clark or plain) when present.

Source
elements
Source
find_ns_prefix(href : String) : String | Nil

The prefix bound to href on this element or its nearest ancestor.

Source
in_scope_namespaces

In-scope namespace bindings (prefix -> href) from the nearest element upward; nearer bindings win.

Source
local_name
Source
name
Source
namespace_uri
Source
node_path

libxml2's xmlGetNodePath: /ancestor/local[n] with the [n] index counted among same-name siblings (omitted when unique); attributes append /@name.

Source
prefix
Source
set_attribute(name : String, value : String) : Nil

Sets attribute name (Clark {uri}local or plain) to value, declaring the namespace on this element when no in-scope binding exists (xmlSetNsProp + xmlNewNs semantics).

Source
text=(value : String) : Nil

Replaces the entire child list with a single text node - the element-content setter the real module's node.text = value uses.

Source
text_content
Source
to_xml(io : IO, pretty : Bool, depth : Int32, indent_size : Int32) : Nil
Source
to_xml(io : IO) : Nil
Source