Class TTreeDocument

Unit

Declaration

type TTreeDocument = class(TTreeNode)

Description

No description available, ancestor TTreeNode description follows

This class representates an element of the html file

It is stored in an unusual tree representation: All elements form a linked list and the next element is the first children, or if there is none, the next node on the same level, or if there is none, the closing tag of the current parent.
E.g. an XML file like <foo><bar>x</bar></foo> is stored as a quadro-linked list:

  /---------------------------------\
  |         |  -----------          |                                   link to parent (for faster access, it would work without it)
 \|/        | \|/        |          |
  '            '
<foo> <---> <bar>  <---> x <--->  </bar>  <--->  </foo>                 double linked list of tags (previous link again for faster access, a single linked list would work as well)
  .           .                     .               .
 /|\         /|\                   /|\             /|\
  |           -----------------------               |                   single linked of corresponding node
  ---------------------------------------------------

There are functions (getNextSibling, getFirstChild, findNext, ...) to access it like a regular tree, but it is easier and faster to work directly with the list.
Some invariants: (SO: set of opening tags in sequence)
∀a \in SO: a < a.reverse
∀a,b \in SO: a < b < a.reverse => a < b.reverse < a.reverse

Attributes should be accessed with the getAttribute or getAttributeTry method. Or you can enumerate them all for attrib in attributes, if attributes is not nil.
#)

Hierarchy

Overview

Methods

Public constructor create(aNodeClass: TTreeNodeClass); reintroduce;
Public function createNode: TTreeNode;
Public function createNode(atyp: TTreeNodeType; avalue: string = ''): TTreeNode;
Public function createAttribute(const aname, avalue: string): TTreeAttribute;
Public function createElementPair(const anodename: string): TTreeNode;
Public function clone: TTreeDocument; overload;
Public function addNamespace(const url, prefix: string): TNamespace;
Public procedure addNamespace(const ns: TNamespace);
Public function getEncoding: TSystemCodePage; deprecated 'support for different encodings is being removed, everything should be set to utf8';
Public procedure addRef;
Public procedure release;
Public procedure FreeInstance; override;
Public destructor destroy; override;

Properties

Public property baseURI: string read FBaseURI write FBaseURI;
Public property documentURI: string read FDocumentURI write FDocumentURI;
Public property baseEncoding: TSystemCodePage read FBaseEncoding write FBaseEncoding;

Description

Methods

Public constructor create(aNodeClass: TTreeNodeClass); reintroduce;
 
Public function createNode: TTreeNode;
 
Public function createNode(atyp: TTreeNodeType; avalue: string = ''): TTreeNode;
 
Public function createAttribute(const aname, avalue: string): TTreeAttribute;
 
Public function createElementPair(const anodename: string): TTreeNode;
 
Public function clone: TTreeDocument; overload;
 
Public function addNamespace(const url, prefix: string): TNamespace;
 
Public procedure addNamespace(const ns: TNamespace);
 
Public function getEncoding: TSystemCodePage; deprecated 'support for different encodings is being removed, everything should be set to utf8';

Warning: this symbol is deprecated: support for different encodings is being removed, everything should be set to utf8

 
Public procedure addRef;
 
Public procedure release;
 
Public procedure FreeInstance; override;
 
Public destructor destroy; override;
 

Properties

Public property baseURI: string read FBaseURI write FBaseURI;
 
Public property documentURI: string read FDocumentURI write FDocumentURI;
 
Public property baseEncoding: TSystemCodePage read FBaseEncoding write FBaseEncoding;
 

Generated by PasDoc 0.16.0.