dxml.writer

This module provides functionality for creating XML 1.0 documents.

Primary Symbols

SymbolDescription
XMLWriterType used for writing XML documents.
xmlWriterFunction used to create an XMLWriter.

Helper Types

XMLWritingExceptionThrown by XMLWriter when it's given data that would result in invalid XML.

Helper Functions

SymbolDescription
writeTaggedTextShortcut for writing text enclosed by tags. e.g. <tag>text</tag>.
writeXMLDeclWrites the optional XML declaration that goes at the top of an XML document to an ouput range.

Members

Aliases

EmptyTag
alias EmptyTag = Flag!"EmptyTag"

$(PHOBOS_REF Flag, std, typecons) indicating whether closeStartTag or writeStartTag or will write an empty element tag (which then does not require a corresponding end tag).

InsertIndent
alias InsertIndent = Flag!"InsertIndent"

$(PHOBOS_REF Flag, std, typecons) indicating whether a write function of XMLWriter which accepts text which may include newlines will write an indent after each newline is written.

Newline
alias Newline = Flag!"Newline"

$(PHOBOS_REF Flag, std, typecons) indicating whether a write function of XMLWriter will write a newline followed by an indent before the entity being written.

Classes

XMLWritingException
class XMLWritingException

Exception thrown when the writer is given data that would result in invalid XML.

Functions

writeTaggedText
void writeTaggedText(ref XW writer, string name, R text, Newline newline = Newline.yes, InsertIndent insertIndent = InsertIndent.yes)
void writeTaggedText(ref XW writer, string name, R text, InsertIndent insertIndent, Newline newline = Newline.yes)

Helper function for writing _text which has a start tag and end tag on each side and no attributes so that it can be done with one function call instead of three.

writeXMLDecl
void writeXMLDecl(ref OR output)

Writes the <?xml...?> declaration to the given output range. If it's going to be used in conjunction with XMLWriter, then either writeXMLDecl will need to be called before constructing the XMLWriter, or XMLWriter._output will need to be used to write to the output range before writing anything else using the XMLWriter. XMLWriter expects to be writing XML after the <?xml...?> and <!DOCTYPE...> declarations (assuming they're present at all), and it is invalid to put a <?xml...?> declaration anywhere but at the very beginning of an XML document.

xmlWriter
auto xmlWriter(OR output, string baseIndent = " ")

Writes XML to an output range of characters.

Structs

XMLWriter
struct XMLWriter(OR)

Writes XML to an output range of characters.

See Also

Meta

Source

See Source File
$(LINK_TO_SRC dxml/_writer.d)