Skip to main content

TsdElementType

TsdElementType = (xeElement, xeAttribute, xeCharData, xeComment, xeCData, xeCondSection, xeDeclaration, xeStylesheet, xeDocType, xeDtdElement, xeDtdAttList, xeDtdEntity, xeDtdNotation, xeInstruction, xeWhiteSpace, xeQuotedText, xeEndTag, xeError)

Example

procedure DescribeNode(Node: TXMLNode; var Value: Variant);
begin
case Node.ElementType of
xeElement: Value := 'element';
xeAttribute: Value := 'attribute';
xeCharData, xeWhiteSpace, xeCData: Value := 'text-like';
else
Value := Node.ElementTypeName;
end;
end;

Usage

TsdElementType identifies every raw Velox XML node kind including elements, text, declarations, DTD constructs, end tags and errors.

Members

ValueOrdinalMeaning
xeElement0Normal XML element with name, attributes and possible children/value.
xeAttribute1Attribute node.
xeCharData2Character-data node.
xeComment3XML comment.
xeCData4CDATA section.
xeCondSection5Intended DTD conditional section; not reliably observable in Velox.
xeDeclaration6XML declaration.
xeStylesheet7xml-stylesheet processing instruction.
xeDocType8DOCTYPE declaration.
xeDtdElement9DTD ELEMENT declaration.
xeDtdAttList10DTD ATTLIST declaration.
xeDtdEntity11DTD ENTITY declaration.
xeDtdNotation12DTD NOTATION declaration.
xeInstruction13General processing instruction.
xeWhiteSpace14Character data containing only whitespace.
xeQuotedText15Quoted text token used by the parser/DTD model.
xeEndTag16Transient text/binary parser end-tag signal; no persistent node class.
xeError17Unknown/error sentinel; no persistent node class.

Behavior and boundaries

  • NodeNew and NodeNewText create xeElement only. Other kinds normally originate in parsed input.
  • ElementCount and Elements[...] count/filter immediate xeElement children only. Raw siblings, document searches and node lookup can expose attributes, comments, text, declarations, instructions and DTD nodes. Test ElementType before assuming element semantics.
  • xeEndTag and xeError have no node-class mapping. They are control/error sentinels, not successful script-visible tree nodes.
  • xeCondSection is not reliable: text parsing does not recognise DTD INCLUDE or IGNORE sections, and conditional sections restored from binary XML are reported as xeComment. Binary round trips therefore lose that distinction.
  • Velox exposes neither Velox XML's whitespace-preservation nor drop-comments parser setting. Vendor defaults compact whitespace but retain comments, so formatting whitespace is normally absent while comments can remain in raw traversal.
  • Reading an element Value concatenates only immediate xeCharData, xeWhiteSpace and xeCData children. It is not recursive item text. Assigning Value rejects mixed/multiple text shapes rather than flattening them.
  • the function exposes Name and Value setters broadly, but individual node serializers do not uniformly validate forbidden sequences. For example ]]> inside CDATA, -- inside a comment, or ?> inside an instruction can produce malformed or prematurely terminated XML.
  • Name, Value, IsEmpty and IsClear depend on the node kind. ElementTypeName is a diagnostic label, not a standards-stable round-trip identifier.
  • All returned nodes are borrowed from their owning document. Do not retain one across document clear, reload or destruction.
  • DTD and conditional-section members show that untrusted XML can create more than the visible element tree. Apply input size, depth, external-resource and trust controls outside this lightweight parser model.

Additional Technical Info

TsdElementType is NativeXML's complete raw node-kind enumeration. TXMLNode.ElementType returns it for any borrowed node in a document tree.

The name ElementType is historical: most members are not XML elements. Element-only accessors filter to xeElement, while raw child and traversal APIs can expose many of the listed concrete kinds. The sentinel and defective cases are detailed below.

Related Code Library entries

External references

Created 2026-07-15