# Standard xne reference

Xne

The `Xne` is a nameset that binds constants used by the xne system.

ID

The `ID` constant defines a node access by id.

PI

The `PI` constant defines an access selector for a processing instruction node.

GE

The `GE` constant defines an access selector for a general entity node.

TAG

The `TAG` constant defines an access selector for a tag node.

ENT

The `ENT` constant defines an access selector for an entity node.

EREF

The `EREF` constant defines an access selector for an entity reference node.

CREF

The `CREF` constant defines an access selector for an character reference node.

ELEM

The `ELEM` constant defines an access selector for an element node.

TEXT

The `TEXT` constant defines an access selector for a text node.

NAME

The `NAME` constant defines a node access by name.

CDATA

The `CDATA` constant defines an access selector for a character data node.

INDEX

The `INDEX` constant defines a node access by child index. The child index is node index seen from the parent.

XneTree

The `XneTree` is the xne node tree manipulation class. The class operates with a node and provides numerous methods to manipulate the tree as well as changing it. Before a tree is manipulated, it is recommended to make a copy of such tree with the help of the node `copy` method.

xne-tree-p
Object
XmlTree
none

The `XmlTree` constructor creates a default tree without a node.

XmlTree
XmlNode

The `XmlTree` constructor creates a tree with a xml node. The node stored in the object is the root of the tree subject to the operations.

depth
Integer
none

The `depth` method returns the depth of the tree.

generate-id
Integer
none

The `generate-id` method generate a unique id for all node in the tree. The id attribute is set by this method.

set-node
none
XmlNode

The `set-node` method sets the root tree node.

get-node
XmlNode
none

The `get-node` method returns the root tree node.

set-attribute
none
none|String

The `set-attribute` method sets an attribute to the whole tree. In the first form, the attribute is set to the whole tree. In the second form with a string argument, the attribute is set only on the tag node those name matches the name argument.

clear-attribute
none
none|String

The `clear-attribute` method clear all attributes of the nodes in the tree. In the first form, the node attributes are cleared for all nodes in the tree. In the second form with a string argument, the attributes are cleared only with the tag node those name matches the name argument.

set-prefix
none
String

The `set-prefix` method sets a prefix on all nodes in the tree.

clear-prefix
none
none

The `clear-prefix` method clear the prefix for all nodes in the tree.

select
Vector
XneCond [Boolean]

The `select` method selects the node in the tree that matches the condition argument. In the first form, with one argument, the whole tree is searched. In the second form, with a boolean argument, the whole tree is searched if the second argument is false. If the boolean argument is true, the method call behaves like a call with the condition only.

XneChild

The `XneCond` is the xne condition class. The sole purpose of this class is to define one or several condition that a node must satisfy in order to be selected. The condition are accumulated in a list and later checked for a particular node. Note that an empty condition always succeeds.

xne-cond-p
Object
XneCond
none

The `XneCond` constructor creates a default condition. The default condition is empty. The empty condition always succeeds.

add
none
Xne [String|Integer]

The `add` adds a condition by type. The first argument is the condition type. The second argument is a condition information such like a string or an integer.

valid-p
Boolean
XmlNode

The `valid-p` predicate checks that a node matches a condition. If the condition succeeds, the predicate returns true.