ddn.data.xml.write
High-level XML serialization / writing entrypoints.
Types 3
Supported output encodings for byte-oriented serialization.
UTF8UTF-8 bytes.
UTF16_LEUTF-16 little-endian bytes.
UTF16_BEUTF-16 big-endian bytes.
structXmlWriteOptions
Options controlling XML serialization.
These options are part of the stable public API.
Fields
XmlOutputEncoding outputEncodingOutput encoding for byte-oriented serialization.bool emitBomWhether to emit a BOM when `outputEncoding` is UTF-16.bool prettyIf `true`, the writer may add indentation and newlines.string indentationIndentation string used when `pretty` is enabled.string newlineNewline string used when `pretty` is enabled.bool omitDeclarationIf `true`, omit the XML declaration (e.g. `<?xml version=...?>`).classXmlStreamWriter
Streaming XML writer that can generate XML without building a DOM.
This is useful for large documents.
Fields
private XmlWriteOptions _optionsprivate void delegate(const(char)[]) @safe _charSinkprivate void delegate(const(ubyte)[]) @safe _byteSinkprivate typeof(appender!string()) _internalSinkprivate string[] _stackprivate bool _startTagOpenprivate bool _finishedprivate bool[] _hasTextChildprivate bool[] _hasElementChildprivate string[string][] _nsStackprivate size_t _nsCounterprivate AttrName[] _currentAttributesMethods
void declareNamespace(string prefix, string uri) @safeDeclares a namespace on the currently open start tag.void startElementNS(string namespaceUri, string local, string prefix = "") @safeStarts an element using a namespace URI and local name.void attributeNS(string namespaceUri, string local, string prefix, string value) @safeWrites a namespace-qualified attribute.void attribute(string qname, string value) @safeWrites an attribute on the currently open start tag.void ensureNotFinished() @safevoid closeStartTagIfNeeded() @safevoid writeIndent(size_t depth) @safeConstructors
this(XmlWriteOptions options = XmlWriteOptions.init)Constructs a new streaming writer using an internal buffer.this(void delegate(const(char)[]) @safe sink, XmlWriteOptions options = XmlWriteOptions.init)Constructs a new streaming writer using a character sink.this(void delegate(const(ubyte)[]) @safe sink, XmlWriteOptions options = XmlWriteOptions.init)Constructs a new streaming writer using a byte sink.Nested Templates
AttrNameFunctions 10
fn
string toXmlString(XmlNode node, XmlWriteOptions options = XmlWriteOptions.init) @safeSerializes a DOM node to an XML string.fn
string writeXml(XmlDocument document, XmlWriteOptions options = XmlWriteOptions.init) @safeSerializes a document to an XML string.fn
void writeXmlTo(R)(ref R sink, XmlNode node, XmlWriteOptions options = XmlWriteOptions.init) if (isOutputRange!(R, char))Writes XML to an output range.fn
ubyte[] toXmlBytes(XmlNode node, XmlWriteOptions options = XmlWriteOptions.init) @safeSerializes a DOM node to raw bytes according to `options.outputEncoding`.fn
ubyte[] writeXmlBytes(XmlDocument document, XmlWriteOptions options = XmlWriteOptions.init) @safeSerializes a document to raw bytes.fn
string serialize(XmlNode node, XmlWriteOptions options = XmlWriteOptions.init) @safeSerializes a DOM node to an XML string.