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 URI http://www.w3.org/2001/XInclude
  • parse='xml' (default): include as parsed XML with optional XPointer selection
  • parse='text': include as text with encoding auto-detection or explicit encoding attribute
  • <xi:fallback>: fallback content when an include fails
  • xml:base propagation for base URI resolution
  • Configurable resource loader policy (allowFile, allowNetwork, custom networkLoader)
  • 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, and accept-charset attributes are not supported
  • XPointer with parse='text' is rejected per spec but the xpointer attribute is silently ignored rather than raising an error in some edge cases

Types 1

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

fnXmlDocument processXInclude(XmlDocument doc, XmlXIncludeOptions options = XmlXIncludeOptions.init) @safeApplies XInclude processing to `doc`.
private fnbool isXIncludeElement(XmlElement el) @safe
private fnXmlElement findFallback(XmlElement include) @safe
private fnstring normalizeTextNewlines(string s) @safe
private fnvoid processElement( XmlDocument owner, XmlElement el, size_t depth, XmlXIncludeOptions options, ref XmlResourceLoader loader) @safe

Variables 1

private enumvarXINCLUDE_NS = "http://www.w3.org/2001/XInclude"