Class Summary : TNamespaceContext

Internal class for a single Namespace context.

This module caches and reuses Namespace contexts, so the number allocated will be equal to the element depth of the document, not to the total number of elements (i.e. 5-10 rather than tens of thousands). Also, data structures used to represent contexts are shared when possible (child contexts without declarations) to further reduce the amount of memory that's consumed.

Methods

procedure copyTables()
function getDefaultNS() : PSAXChar
function getPrefixTable() : SAXStringArray
function getPrefixTableElements() : SAXStringArray
function getPrefixTableLength() : Integer
function getUriTable() : SAXStringArray
function getUriTableElements() : SAXStringArray
function getUriTableLength() : Integer
function getDeclarations() : SAXStringArray
procedure setParent(TNamespaceContext)
procedure clear()
procedure declarePrefix(SAXString, SAXString)
procedure declarePrefix(PSAXChar, Integer, PSAXChar, Integer)
function processName(SAXString, Boolean) : TNamespaceParts
function processName(PSAXChar, Integer, Boolean) : TNamespaceParts
function getURI(SAXString) : SAXString
function getURI(PSAXChar, Integer) : PSAXChar
function getPrefix(SAXString) : SAXString
function getPrefix(PSAXChar, Integer) : PSAXChar
function getDeclaredPrefixes() : SAXStringArray
function getPrefixes() : SAXStringArray

Properties



procedure copyTables();

Copy on write for the internal tables in this context.

This class is optimized for the normal case where most elements do not contain Namespace declarations.


Top


function getDefaultNS() : PSAXChar;


Top


function getPrefixTable() : SAXStringArray;


Top


function getPrefixTableElements() : SAXStringArray;


Top


function getPrefixTableLength() : Integer;


Top


function getUriTable() : SAXStringArray;


Top


function getUriTableElements() : SAXStringArray;


Top


function getUriTableLength() : Integer;


Top


function getDeclarations() : SAXStringArray;


Top


procedure setParent(const parent : TNamespaceContext);

(Re)set the parent of this Namespace context. The context must either have been freshly constructed, or must have been cleared
Parameter : context The parent Namespace context object.

Top


procedure clear();

Makes associated state become collectible, invalidating this context. setParent must be called before this context may be used again.

Top


procedure declarePrefix(const prefix : SAXString; const uri : SAXString);

Declare a Namespace prefix for this context.
Parameter : prefix The prefix to declare.
Parameter : uri The associated Namespace URI.
See : TNamespaceSupport.declarePrefix

Top


procedure declarePrefix( prefix : PSAXChar; prefixLength : Integer; uri : PSAXChar; uriLength : Integer);

Declare a Namespace prefix for this context.
Parameter : prefix The prefix to declare.
Parameter : prefixLength The length of the prefix buffer The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : uri The associated Namespace URI.
Parameter : uriLength The length of the uri buffer The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
See : TNamespaceSupport.declarePrefix

Top


function processName(const qName : SAXString; isAttribute : Boolean) : TNamespaceParts;

Process a raw XML 1.0 name in this context.
Parameter : qName The raw XML 1.0 name.
Parameter : isAttribute true if this is an attribute name.
Result : An array of three strings containing the URI part (or empty string), the local part, and the raw name, all internalized, or empty if there is an undeclared prefix.
See : TNamespaceSupport.processName

Top


function processName( qName : PSAXChar; qNameLength : Integer; isAttribute : Boolean) : TNamespaceParts;

Process a raw XML 1.0 name in this context.
Parameter : qName The raw XML 1.0 name.
Parameter : qNameLength The length of the qName buffer The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : isAttribute true if this is an attribute name.
Result : An array of three PSAXChars (null terminated) containing the URI part (or empty string), the local part, and the raw name, all internalized, or empty if there is an undeclared prefix.
See : TNamespaceSupport.processName

Top


function getURI(const prefix : SAXString) : SAXString;

Look up the URI associated with a prefix in this context.
Parameter : prefix The prefix to look up.
Result : The associated Namespace URI, or empty if none is declared.
See : TNamespaceSupport.getURI

Top


function getURI( prefix : PSAXChar; prefixLength : Integer) : PSAXChar;

Look up the URI associated with a prefix in this context.
Parameter : prefix The prefix to look up.
Parameter : prefixLength The length of the prefix buffer The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Result : The associated Namespace URI, or empty if none is declared.
See : TNamespaceSupport.getURI

Top


function getPrefix(const uri : SAXString) : SAXString;

Look up one of the prefixes associated with a URI in this context.

Since many prefixes may be mapped to the same URI, the return value may be unreliable.


Parameter : uri The URI to look up.
Result : The associated prefix, or empty if none is declared.
See : TNamespaceSupport.getPrefix

Top


function getPrefix( uri : PSAXChar; uriLength : Integer) : PSAXChar;

Look up one of the prefixes associated with a URI in this context.

Since many prefixes may be mapped to the same URI, the return value may be unreliable.


Parameter : uri The URI to look up.
Parameter : uriLength The length of the URI buffer The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Result : The associated prefix, or empty if none is declared.
See : TNamespaceSupport.getPrefix

Top


function getDeclaredPrefixes() : SAXStringArray;

Return an enumeration of prefixes declared in this context.
Result : An enumeration of prefixes (possibly empty).
See : TNamespaceSupport.getDeclaredPrefixes

Top


function getPrefixes() : SAXStringArray;

Return an enumeration of all prefixes currently in force.

The default prefix, if in force, is not returned, and will have to be checked for separately.


Result : An enumeration of prefixes (never empty).
See : TNamespaceSupport.getPrefixes

Top


prefixTable

Extension properties to get properties from self or parent

property prefixTable : SAXStringArray read getPrefixTable

Top


prefixTableElements


property prefixTableElements : SAXStringArray read getPrefixTableElements

Top


prefixTableLength


property prefixTableLength : Integer read getPrefixTableLength

Top


uriTable


property uriTable : SAXStringArray read getUriTable

Top


uriTableElements


property uriTableElements : SAXStringArray read getUriTableElements

Top


uriTableLength


property uriTableLength : Integer read getUriTableLength

Top


defaultNS


property defaultNS : PSAXChar read getDefaultNS

Top


declarations


property declarations : SAXStringArray read getDeclarations

Top