Kōtuku
  • Gallery
  • API
  • Wiki
  • GitHub
    •  Overview
    • XValueNodes()
    • XValueToNumber()
    • XValueToString()
    • Audio
    • Config
    • Core
    • Display
    • Document
    • Font
    • HTTP
    • Network
    • Regex
    • SVG
    • Tiri
    • Vector
    • XML
    • XQuery
    • XRandR
      • Audio
      • MP3
      • Sound
      • File
      • MetaClass
      • Module
      • StorageDevice
      • Task
      • Thread
      • Time
      • Compression
      • CompressedStream
      • Config
      • LZMAStream
      • Script
      • Tiri
      • XML
      • XQuery
      • Controller
      • BlurFX
      • ColourFX
      • CompositeFX
      • ConvolveFX
      • DisplacementFX
      • FilterEffect
      • FloodFX
      • ImageFX
      • LightingFX
      • MergeFX
      • MorphologyFX
      • OffsetFX
      • RemapFX
      • SourceFX
      • TurbulenceFX
      • WaveFunctionFX
      • Scintilla
      • Bitmap
      • Clipboard
      • Display
      • Document
      • Font
      • Image
      • Pointer
      • Surface
      • SVG
      • ClientSocket
      • HTTP
      • NetClient
      • NetLookup
      • NetServer
      • NetSocket
      • Proxy
      • Gradient
      • GradientConic
      • GradientContour
      • GradientDiamond
      • GradientDiffusion
      • GradientDistal
      • GradientGouraud
      • GradientLinear
      • GradientMesh
      • GradientRadial
      • GradientVoronoi
      • Vector
      • VectorClip
      • VectorColour
      • VectorEllipse
      • VectorFilter
      • VectorGradient
      • VectorGroup
      • VectorImage
      • VectorPath
      • VectorPattern
      • VectorPolygon
      • VectorRectangle
      • VectorScene
      • VectorShape
      • VectorSpiral
      • VectorText
      • VectorTransition
      • VectorViewport
      • VectorWave
      • Linux Builds
      • Windows Builds
      • Customising Your Build
      • Kōtuku Objects
      • Kōtuku In Depth
      • Kōtuku Design Patterns
      • Coding With AI
      • Regex Manual
      • XML Comparisons
      • Tiri Reference Manual
      • Config API
      • Defer Syntax
      • GUI API
      • HTTP Server API
      • I/O API
      • JSON API
      • OAuth API
      • Options API
      • Proxy Server API
      • Tempus API
      • URL API
      • VFX API
      • Widgets
      • RIPL Reference Manual
      • Origo
      • Flute / Unit Testing
      • Tuku
      • Embedded Document Format
      • TDL Reference Manual
      • TDL Tools
      • Action Reference Manual
      • System Error Codes

XML Module

Provides an interface for the management of structured data.

The XML module provides comprehensive support for XML 1.0 document parsing, manipulation, and querying. It integrates with the XPath module to deliver a standards-compliant XML processing environment with extensive querying capabilities.

XML Processing

The module implements full XML 1.0 parsing and serialisation, including support for namespaces, attributes, CDATA sections, processing instructions, and DOCTYPE declarations. Documents can be loaded from files, strings, or streams, and modified programmatically through a tree-based API. The parser validates well-formedness and provides detailed error reporting for malformed documents.

XPath 2.0+ Support

All aspects of XPath 2.0 are supported except for the following:

  • Namespace axis: The namespace::* and namespace::prefix axis expressions are not supported.
  • Schema imports: Schema import declarations are not recognised.
  • External variables: External variable declarations (declare variable $name external) are not supported.
  • Custom collations: Only the W3C codepoint collation (http://www.w3.org/2005/xpath-functions/collation/codepoint) is supported. Custom collation URIs are rejected.

XQuery 1.0+ Support

The module implements core XQuery 1.0 functionality, including FLWOR expressions (for, let, where, order by, return, group by, count clauses), node constructors (element, attribute, document, text, comment, processing instruction), and a comprehensive function library covering strings, numbers, sequences, dates, durations, QNames, and document access. XQuery support excludes the following:

  • Schema-aware processing: Type validation against XML Schema is not supported.

Functions

XValueNodes | XValueToNumber | XValueToString

Structures

XMLAttrib | XPathValue | XTag

Classes

XML

Constants

XPVT | XTF

XValueNodes()

For node-set XPathValue objects, returns the node-set as an array.

ERR xml::XValueNodes(struct XPathValue * Value, kt::vector<XTag *> * Result)
ParameterDescription
ValueThe XPathValue to convert.
ResultThe node-set is returned here as an array of XTag structures.

If an XPathValue represents a node-set (type XPVT::NODE_SET) then XValueToNodes() will return a direct pointer to the node-set array.

Note: The integrity of the array is not guaranteed if the original XML document is modified or freed.

Error Codes

OkayOperation successful.
NoDataNo data is available for use
MismatchA mis-match has been detected that prevents further processing
NullArgsFunction call missing argument value(s)
XML module documentation © Paul Manias © 2001-2026

XValueToNumber()

Converts an XPathValue to a 64-bit floating point value.

ERR xml::XValueToNumber(struct XPathValue * Value, DOUBLE * Result)
ParameterDescription
ValueThe XPathValue to convert.
ResultThe numeric representation of the value is returned here.

Call XValueToNumber() to convert an XPathValue object to a 64-bit floating point number. This function also includes cover support for boolean types, converting true to 1.0 and false to 0.

Error Codes

OkayOperation successful.
NoDataNo data is available for use
NullArgsFunction call missing argument value(s)
XML module documentation © Paul Manias © 2001-2026

XValueToString()

Converts an XPathValue to its string representation.

ERR xml::XValueToString(const struct XPathValue * Value, STRING * Result)
ParameterDescription
ValueThe XPathValue to convert.
ResultReceives the string representation of the value.

Call XValueToString() to convert an XPathValue object into its string representation.

Error Codes

OkayOperation successful.
NoDataNo data is available for use
NullArgsFunction call missing argument value(s)
XML module documentation © Paul Manias © 2001-2026

XPVT Type

Type descriptors for XPathValue

NameDescription
XPVT::Array
XPVT::Boolean
XPVT::Date
XPVT::DateTime
XPVT::Map
XPVT::NodeSet
XPVT::Number
XPVT::String
XPVT::Time
XML module documentation © Paul Manias © 2001-2026

XTF Type

Standard flags for XTag.

NameDescription
XTF::CDATATag represents CDATA.
XTF::COMMENTTag represents a comment of the format <!-- Comment -->.
XTF::INSTRUCTIONTag represents an instruction of the format <?xml?>.
XTF::NOTATIONTag represents a notation of the format <!XML>.
XML module documentation © Paul Manias © 2001-2026

XMLAttrib Structure

FieldTypeDescription
NameSTRINGName of the attribute
ValueSTRINGValue of the attribute
XML module documentation © Paul Manias © 2001-2026

XPathValue Structure

FieldTypeDescription
TypeXPVTIdentifies the type of value stored
NumberValueDOUBLEDefined if the type is Number or Boolean
StringValueSTRINGDefined if the type is String
XML module documentation © Paul Manias © 2001-2026

XTag Structure

FieldTypeDescription
IDINTGlobally unique ID assigned to the tag on creation.
ParentIDINTUID of the parent tag
LineNoINTLine number on which this tag was encountered
FlagsXTFOptional flags
NamespaceIDUINTHash of namespace URI or 0 for no namespace
ReservedINTPrivate
Attribskt::vector<XMLAttrib>Array of attributes for this tag
Childrenkt::vector<XTag>Array of child tags
XML module documentation © Paul Manias © 2001-2026