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
| Value | Ordinal | Meaning |
|---|---|---|
xeElement | 0 | Normal XML element with name, attributes and possible children/value. |
xeAttribute | 1 | Attribute node. |
xeCharData | 2 | Character-data node. |
xeComment | 3 | XML comment. |
xeCData | 4 | CDATA section. |
xeCondSection | 5 | Intended DTD conditional section; not reliably observable in Velox. |
xeDeclaration | 6 | XML declaration. |
xeStylesheet | 7 | xml-stylesheet processing instruction. |
xeDocType | 8 | DOCTYPE declaration. |
xeDtdElement | 9 | DTD ELEMENT declaration. |
xeDtdAttList | 10 | DTD ATTLIST declaration. |
xeDtdEntity | 11 | DTD ENTITY declaration. |
xeDtdNotation | 12 | DTD NOTATION declaration. |
xeInstruction | 13 | General processing instruction. |
xeWhiteSpace | 14 | Character data containing only whitespace. |
xeQuotedText | 15 | Quoted text token used by the parser/DTD model. |
xeEndTag | 16 | Transient text/binary parser end-tag signal; no persistent node class. |
xeError | 17 | Unknown/error sentinel; no persistent node class. |
Behavior and boundaries
NodeNewandNodeNewTextcreatexeElementonly. Other kinds normally originate in parsed input.ElementCountandElements[...]count/filter immediatexeElementchildren only. Raw siblings, document searches and node lookup can expose attributes, comments, text, declarations, instructions and DTD nodes. TestElementTypebefore assuming element semantics.xeEndTagandxeErrorhave no node-class mapping. They are control/error sentinels, not successful script-visible tree nodes.xeCondSectionis not reliable: text parsing does not recognise DTDINCLUDEorIGNOREsections, and conditional sections restored from binary XML are reported asxeComment. 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
Valueconcatenates only immediatexeCharData,xeWhiteSpaceandxeCDatachildren. It is not recursive item text. AssigningValuerejects mixed/multiple text shapes rather than flattening them. - the function exposes
NameandValuesetters 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,IsEmptyandIsCleardepend on the node kind.ElementTypeNameis 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
- TXMLNode.ElementType - raw node-kind accessor.
- TXMLNode.ElementTypeName - diagnostic name mapping.
- TXMLNode.Elements - element-only filtered access.
- TXMLNode.NextSibling - raw sibling navigation.
External references
- W3C XML 1.0 - standard XML constructs represented by these node kinds.
- SimDesign NativeXML source archive - upstream NativeXML source distribution represented by the vendored implementation.
- Embarcadero enumerated types - Delphi ordinal semantics.
- Free Pascal ordinal types - compatible enumeration concepts.