ddn.data.xml.parse
High-level XML parsing entrypoints.
Types 4
structXmlParserLimits
Limits enforced by the XML parser to prevent resource exhaustion attacks.
Fields
size_t maxInputBytesMaximum size of the input XML in bytes.size_t maxExpandedBytesHard limit on total bytes produced by entity expansion.size_t maxExpansionDepthHard limit on entity expansion nesting depth.size_t maxRecursionDepthMaximum element nesting depth.size_t maxAttributeCountMaximum number of attributes per element.size_t maxNameLengthMaximum length of names (element names, attribute names, etc).structXmlParseOptions
Options controlling XML parsing.
Fields
bool recoverIf `true`, the parser may attempt to continue after certain recoverable errors.bool forbidDoctypeIf `true`, any `DOCTYPE` declaration is rejected.bool expandEntitiesIf `true`, entities and character references are expanded.bool preserveWhitespaceIf `true`, whitespace-only text nodes are preserved.XmlParserLimits limitsParser resource limits.bool allowExternalSubsetIf `true`, allow loading the external DTD subset referenced by `<!DOCTYPE ... SYSTEM "...">`.string[] catalogFilesOptional OASIS XML Catalog files used for resolving external identifiers.bool validateDtdIf `true`, perform basic DTD validation.bool applyDtdDefaultsIf `true`, apply DTD default/fixed attributes from `<!ATTLIST ...>` declarations.bool useArenaAllocatorIf `true`, store parsed/decoded strings in a per-document arena.aliasXmlByteSource = const(ubyte)[] delegate() @safe
Byte source used by parseDocumentSource.
The delegate is expected to return the full XML document bytes.
aliasparseXml = parseDocument
Alias for parseDocument for a more concise, idiomatic API.
Functions 10
fn
XmlDocument parseDocument(
string input,
XmlParseOptions options = XmlParseOptions.init,
string systemId = "") @safeParses a complete XML document from a UTF-8 `string`.fn
XmlDocument parseDocument(
const(ubyte)[] input,
XmlParseOptions options = XmlParseOptions.init,
string systemId = "") @safeParses a complete XML document from UTF-8 bytes.fn
XmlDocument parseDocumentFile(string path, XmlParseOptions options = XmlParseOptions.init) @safeParses a complete XML document from a file.fn
XmlDocument parseDocumentSource(
XmlByteSource source,
XmlParseOptions options = XmlParseOptions.init,
string systemId = "") @safeParses a complete XML document from a user-provided byte source.fn
XmlNode[] parseFragment(
string fragment,
XmlParseOptions options = XmlParseOptions.init,
string systemId = "") @safeParses an XML fragment into a list of nodes.fn
XmlNode[] parseFragment(
const(ubyte)[] fragment,
XmlParseOptions options = XmlParseOptions.init,
string systemId = "") @safeParses an XML fragment from UTF-8 bytes.fn
XmlNode[] parseFragmentFile(string path, XmlParseOptions options = XmlParseOptions.init) @safeParses an XML fragment from a file.fn
XmlNode[] parseFragmentSource(
XmlByteSource source,
XmlParseOptions options = XmlParseOptions.init,
string systemId = "") @safeParses an XML fragment from a user-provided byte source.fn
XmlDocument ctParseXml(string xml)()A CTFE-compatible wrapper for parsing XML strings at compile time.