ddn.data.xml.xinclude
XInclude 1.0 processing.
This module implements the W3C XInclude 1.0 mechanism for merging XML fragments from external resources into a document.
Supported features:
<xi:include href='...'/>with the XInclude namespace URIhttp://www.w3.org/2001/XIncludeparse='xml'(default): include as parsed XML with optional XPointer selectionparse='text': include as text with encoding auto-detection or explicitencodingattribute<xi:fallback>: fallback content when an include failsxml:basepropagation for base URI resolution- Configurable resource loader policy (
allowFile,allowNetwork, customnetworkLoader) - Bounded recursion depth (
maxDepth) - Resource caching (
cacheResources)
Security: File and network loading are both disabled by default. Enable allowFile only for trusted input and allowNetwork only with a controlled networkLoader.
Remaining limitations:
- Only local filesystem and custom loader URIs are supported; no built-in HTTP/HTTPS fetching
accept,accept-language, andaccept-charsetattributes are not supported- XPointer with
parse='text'is rejected per spec but thexpointerattribute is silently ignored rather than raising an error in some edge cases
var XINCLUDE_NS
struct XmlXIncludeOptions
Types 1
structXmlXIncludeOptions
XInclude options.
Fields
size_t maxDepthMaximum include nesting depth.bool allowFileIf `true`, allow local filesystem includes.bool allowNetworkIf `true`, allow network/URI includes.const(ubyte)[] delegate(string uri) @safe networkLoaderOptional loader for non-`file:` URIs.bool cacheResourcesIf `true`, cache loaded include payloads by resolved identifier.Functions 5
fn
XmlDocument processXInclude(XmlDocument doc, XmlXIncludeOptions options = XmlXIncludeOptions.init) @safeApplies XInclude processing to `doc`.private fn
void processElement(
XmlDocument owner,
XmlElement el,
size_t depth,
XmlXIncludeOptions options,
ref XmlResourceLoader loader) @safeVariables 1
private enumvar
XINCLUDE_NS = "http://www.w3.org/2001/XInclude"