ddn.data.xml.errors

Shared error types and location tracking.

Types 4

Machine-readable error codes for XML parsing, validation, and serialization.

UNKNOWNUnspecified/unknown error.
UNEXPECTED_EOFAn unexpected end-of-input was encountered.
INVALID_ENCODINGInput is not valid UTF-8 (or violates XML character rules).
INVALID_NAMEA name (Name/NCName/QName) is invalid.
MISMATCHED_TAGStart/end tags do not match or nesting is invalid.
DOCTYPE_FORBIDDENA `DOCTYPE` declaration was rejected by options/policy.
ENTITY_EXPANSION_LIMITEntity expansion exceeded a safety limit.
DUPLICATE_ATTRIBUTEDuplicate attribute detected (same expanded name).
XML_DECLARATION_INVALIDXML declaration (`<?xml ...?>`) is malformed or invalid.
INVALID_CHARACTERAn invalid XML character (per the XML version's character constraints) was encountered.
EXTERNAL_SUBSET_FORBIDDENExternal subset loading was attempted but is not allowed/supported by policy.
EXTERNAL_SUBSET_IO_ERRORExternal subset loading failed due to an I/O error (missing file, read failure, etc.).
DOCTYPE_ROOT_MISMATCHDOCTYPE name does not match the document element name.
REQUIRED_ATTRIBUTE_MISSINGA required DTD attribute (`#REQUIRED`) is missing.
FIXED_ATTRIBUTE_MISMATCHA `#FIXED` DTD attribute is present with a value different from the fixed default.
ENUMERATION_ATTRIBUTE_MISMATCHA DTD enumerated attribute has a value not in its declared enumeration.
DTD_UNDECLARED_ELEMENTAn element appears in the document but has no DTD `<!ELEMENT ...>` declaration.
DTD_CONTENT_MODEL_VIOLATIONAn element's children/text violate its DTD element content model.
XPOINTER_SYNTAX_ERRORXPointer syntax error.
XPOINTER_UNSUPPORTED_SCHEMEXPointer scheme is not supported.
XPOINTER_NOT_FOUNDXPointer did not resolve to any node.
XPOINTER_INVALID_ELEMENT_SEQUENCEXPointer `element()` sequence is invalid.
DUPLICATE_IDDuplicate `ID` value detected during DTD validation.
UNRESOLVED_IDREF`IDREF`/`IDREFS` references a missing `ID`.
XINCLUDE_FORBIDDENXInclude network/URI include is forbidden by policy.
XINCLUDE_IO_ERRORXInclude failed due to an I/O error (missing include file, etc.).
XINCLUDE_UNSUPPORTEDXInclude feature/syntax is not supported by the current implementation phase.
XINCLUDE_RECURSION_LIMITXInclude recursion limit exceeded.
INPUT_SIZE_LIMITInput XML size exceeded a safety limit.
RECURSION_LIMITElement nesting depth exceeded a safety limit.
ATTRIBUTE_COUNT_LIMITNumber of attributes on an element exceeded a safety limit.
NAME_LENGTH_LIMITLength of an XML name (element, attribute, etc.) exceeded a safety limit.

Location of an error (or event) inside an XML input.

A location is considered unknown when all fields are left at their defaults.

Fields
ulong line1-based line number (0 means unknown).
ulong column1-based column number (0 means unknown).
ulong byteOffset0-based byte offset (0 means unknown).
string systemIdOptional system identifier (e.g. filename, URL). Empty means unknown.
Methods
bool isKnown() const @safe pure nothrowReturns `true` if any location component is known.
string toString() const @safeConverts this location to a human-readable string.
structXmlError

Represents an XML-related error with a code and optional location/cause.

Fields
XmlErrorCode codeError code.
string messageHuman-readable error message.
XmlLocation locationOptional location.
Throwable causeOptional underlying cause.
Methods
string toString() const @safeFormats this error for human consumption.
Constructors
this( XmlErrorCode code, string message, XmlLocation location = XmlLocation.init, Throwable cause = null)Constructs an `XmlError`.
classXmlException : Exception

Exception type used by ddn.data.xml for XML failures.

Design note: The library is exception-centric for error reporting: parsing/validation functions will throw XmlException on failure. This provides ergonomic stack traces and integrates naturally with D error handling, while still allowing callers to catch and inspect structured error data.

Fields
XmlError errorStructured error information.
Methods
string toString() const @safe
Constructors
this(XmlError error)Constructs an `XmlException` from an `XmlError`.

Functions 1

private fnstring formatErrorCode(XmlErrorCode code) @safe pure nothrow