Orchard Nodes and Document Conventions

NOTE: This document reflects changes yet to be made in Perl, Python, and C.

All nodes in Orchard have the folowing properties:

  (raw node)
  ----------
  intrinsic:node-type
  intrinsic:parent
  intrinsic:namespace-uri

  The namespace for 'intrinsic' is 'uri:to-be-determined'.

Each Orchard language has a mapping from these "canonical" names to names in that languages standard convention: Python: `namespace_uri', Perl: `NamespaceURI', C: `namespace_uri'.

Properties in Orchard nodes are very flexible, and are generally considered undefined until some code (an initializer, reader, or user application) sets them. In node diagrams, `plain text' is used to indicate properties that should always be available and valid for a completely read or initialized node; `italicised text' is used to indicate properties that are optional or valid only in certain circumstances. In node diagrams, the node type ("(raw node)" above) is displayed above the line in the diagram, the fully qualified name of the node type is the node's intrinsic:namespace-uri and the node type.

`intrinsic:node-type' is the node type for that node, a plain text name. (to be described: node type names, wrt. canonicilization and common names, and wrt. to XML Name production.)

`intrinsic:parent' is the parent node of this node, if this node appears in a tree of nodes.

`intrinsic:namespace-uri' is the default namespace of properties in this node. Unqualified property accesses ("local name" only) pick up the namespace portion of the qualified name from `intrinsic:namespace-uri'.

XML Nodes

  document  element        attribute      characters
  --------  -------------  -------------  ----------
  contents  name           name           data
  root      attributes     value
            contents       namespace-uri
            namespace-uri  local-name
            local-name     prefix
            prefix

  The 'intrinsic:namespace-uri' of XML nodes
  is 'http://www.w3.org/XML/1998/namespace'.

The `contents' property of a document or element node are a list of the nodes within that document or element.

The `name' of an element or attribute node is name of the element, including prefix, if any.

The `root' of a document is the root element of the document.

An element's `attributes' is a container indexed by the attribute's `name' property.

The `value' of an attribute is the normalized, string value of the attribute.

The `data' of a characters node is XML text.

XML Namespaces

If an XML document uses XML Namespaces, the following additional properties are available on element and attribute nodes.

`namespace-uri' is the XML Namespace URI string.

`local-name' is local-name portion of the element name (the element name without the prefix).

`prefix' is the prefix portion of the element name (the element name without the local-name).

The `attributes' container is indexed also by the namespace-uri/local-name pair of each attribute. When accessing documents using XML Namespaces, you should only use the namespace-uri/local-name indexes for attributes.

XML Namespace processing is used by default if the document uses XML Namespaces.