# Standard xne reference

XsmNode

The `XsmNode` is a base class which is part of the xml simple model (xsm). In this model, a xml (or sgml, or html) text is represented by a node which can be either a tag, a text or a reference node. There is no concept of tree. The node content is stored in the form of a text string. This simple model is designed to parse weak data representation such like html text and later process it at the user discretion. The default representation is an empty text node.

xsm-node-p
Object
TXT

The `TXT` constant defines a xsm text node.

TAG

The `TAG` constant defines a xsm tag node.

REF

The `REF` constant defines a xsm reference node.

END

The `END` constant defines a xsm end node.

XsmNode
none

The `XsmNode` constructor creates a default xsm node which is an empty text node.

XsmNode
String

The `XsmNode` constructor creates a xsm text node by value. The string argument is the text node value

XsmNode
Item String

The `XsmNode` constructor creates a xsm text node by type and value. The first argument is the node type. The second argument is the node text value.

text-p
Boolean
none

The `text-p` predicate returns true if the node is a text node.

tag-p
Boolean
none

The `tag-p` predicate returns true if the node is a tag node.

ref-p
Boolean
none

The `reference-p` predicate returns true if the node is a reference node.

end-p
Boolean
none

The `end-p` predicate returns true if the node is a reference node.

normal-p
Boolean
none

The `normal-p` predicate returns true if the node is a normal tag node.

reserved-p
Boolean
none

The `reserved-p` predicate returns true if the node is a reserved tag node.

textable-p
Boolean
none

The `textable-p` predicate returns true if the node is a textable node, that is a text node or a reference node.

get-source-line
Integer
none

The `get-source-line` method returns the node source line number if any.

set-source-line
none
Integer

The `set-source-line` method sets the node source line number.

get-source-name
String
none

The `get-source-name` method returns the node source name if any.

set-source-name
none
String

The `set-source-name` method sets the node source name.

get-name
String
none

The `get-name` method returns the next available name. name.

XsmReader

The `XmlReader` class is the simple model node reader. The reader operates with the `parse` method and returns a node or nil if the end of stream is reached. Unlike the xml reader, this reader does not build a tree and the node content is not even parsed. In this model, the node content is to be interpreted at the user discretion.

xsm-reader-p
Object
XsmReader
none

The `XsmReader` constructor creates a default xsm reader. The reader is not bound to any stream.

XsmReader
Input

The `XsmReader` constructor creates a xsm reader with an input stream. The argument is the input bound to the reader.

XsmReader
String

The `XsmReader` constructor creates a xsm reader with an input string stream. The argument is a string which is used to create an input string stream bound to the reader.

set-input-stream
none
Input

The `set-input-stream` method bind a new input stream to the reader. Subsequent read will use the newly bound stream

get-node
XsmNode
none

The `get-node` method parses the input stream and returns the available node.

XsmDocument

The `XsmDocument` class is the document class that maintains a xsm document along with its associated list of nodes and other useful information. Generally the class is constructed with a file name or a name and an input stream that is used for parsing the input data. When the input stream has been parsed, the nodes are stored in a vector which can be access by index.

document-p
Nameable
XsmDocument
none

The `XsmDocument` constructor creates a default xsm document.

XsmDocument
String

The `XsmDocument` constructor creates a xsm document by name. The string argument is the file name to parse.

XsmDocument
String Input

The `XsmDocument` constructor creates a xsm document by name and by parsing the input stream. The first argument is the xsm document name. The second argument is the input stream to parse.

set-name
none
String

The `set-name` method sets the xsm document name. The `get-name` method is available from the `nameable` base class.

length
Integer
none

The `length` method returns the xsm document length. The document length is the number of nodes parsed and stored in the document.

get-node
XsmNode
Integer

The `get-node` method returns a document node by index.

get-info
XsoInfo
Integer [Boolean]

The `get-info` method returns a node info object by index. The info object is evaluated dynamically from the document node. In the first form, the node name is used to find the node end tag in order to construct the info text value. In the second form, the boolean argument, if true, forces the node name to be converted to lower case prior any comparison.

get-info-vector
XsoInfo
String [Boolean]

The `get-info-vetcor` method returns an info object vectror by name. Each info object have their name that matches the string argument. The info object is evaluated dynamically from the document node. In the first form, the node name is used to match a tag node and then find the node end tag in order to construct the info text value. In the second form, the boolean argument, if true, forces the node name to be converted to lower case prior any comparison.