cravan371/xpath-evaluator/model does not have a README file

    Document

    pub struct Document {
    token : Array[Unit]
    nodes : Array[NodeRecord]
    root_index : Int
    id_index : Array[(String, Int)]
    }

    Immutable XPath-owned document arena.

    All nested arrays are deep-copied when the builder is finished and are never exposed directly.

    Document::attributes

    Return attributes in source order. They are not child nodes.

    Document::children

    Return child-axis nodes in document order.

    Document::document_order

    Return the stable document-order rank used for NodeSet normalization.

    Document::element_by_id

    fn Document::element_by_id(self : Document, value : String) -> NodeId?

    Find the element whose explicitly typed ID exactly matches value.

    Document::kind

    Return a node's kind, rejecting an invalid or foreign identity.

    Document::name

    Return the expanded name for element, attribute, namespace and PI nodes.

    Document::namespaces

    Return in-scope namespace nodes in deterministic prefix order.

    Document::parent

    Return the parent/owner relation; root has no parent.

    Document::root

    fn Document::root(self : Document) -> NodeId

    Return the unique XPath root node.

    Document::string_value

    Compute the XPath 1.0 string-value of a node.

    DocumentBuilder

    pub struct DocumentBuilder {
    token : Array[Unit]
    nodes : Array[NodeRecord]
    id_index : Array[(String, Int)]
    root_index : Int?
    finished : Bool
    }

    Single-owner builder used by XML and external-tree adapters.

    DocumentBuilder::add_attribute

    fn DocumentBuilder::add_attribute(self : DocumentBuilder, element : NodeId, name : QName, value : String, is_id : Bool) -> NodeId raise
    XPathError

    Add an attribute owned by element.

    An element cannot contain two attributes with the same expanded name, and the document cannot contain two attributes claiming the same typed-ID value.

    DocumentBuilder::add_comment

    Add a comment node.

    DocumentBuilder::add_element

    Add an element as a child of parent.

    DocumentBuilder::add_namespace

    fn DocumentBuilder::add_namespace(self : DocumentBuilder, element : NodeId, prefix : String, uri : String) -> NodeId raise
    XPathError

    Materialize one in-scope namespace node for element.

    Prefixes are unique per element. Empty URIs, xmlns, and a non-standard binding for xml are rejected.

    DocumentBuilder::add_processing_instruction

    fn DocumentBuilder::add_processing_instruction(self : DocumentBuilder, parent : NodeId, target : String, value : String) -> NodeId raise
    XPathError

    Add a processing-instruction node.

    DocumentBuilder::add_root

    Add the XPath root node.

    DocumentBuilder::add_text

    Add non-empty text. Adjacent text children are coalesced and return the existing text identity.

    DocumentBuilder::finish

    Validate all structural invariants and freeze the arena.

    DocumentBuilder::new

    Create an empty builder. Exactly one root node must be added before finish.

    NodeId

    pub struct NodeId {
    token : Array[Unit]
    index : Int
    }

    Stable identity of one node inside a single Document.

    The token is deliberately private. Equality uses physical token identity plus the arena offset, so equal offsets from different documents never compare equal.
    impl Eq for NodeId

    NodeKind

    pub(all) enum NodeKind {
    Root
    Element
    Attribute
    Namespace
    Text
    ProcessingInstruction
    Comment
    } derive(Eq,
    Debug
    )

    The seven node kinds in the XPath 1.0 data model.

    NodeRecord

    type NodeRecord

    Internal arena record shared by the builder and frozen document.

    QName

    pub struct QName {
    prefix : String?
    local_name : String
    namespace_uri : String?
    } derive(
    Debug
    )

    Expanded XML name. prefix is lexical metadata; equality in XPath name tests is based on local_name and namespace_uri.
    impl Eq for QName

    QName::local_name

    fn QName::local_name(self : QName) -> String

    Local part used by XPath expanded-name comparison.

    QName::namespace_uri

    fn QName::namespace_uri(self : QName) -> String?

    Resolved namespace URI; None denotes the null namespace URI.

    QName::new

    fn QName::new(local_name : String, prefix? : String, namespace_uri? : String) -> QName

    Construct an expanded name.

    QName::prefix

    fn QName::prefix(self : QName) -> String?

    Original lexical prefix, when one was present.