XMLWriter.closeStartTag

Writes the end of a start tag to the ouput range.

It is an error to call closeStartTag unless a start tag has been opened and not yet closed.

struct XMLWriter(OR)
void
closeStartTag
if (
isOutputRange!(OR, char)
)

Parameters

emptyTag EmptyTag

Whether the start tag will be empty (i.e. terminated with "/>" so that there is no corresponding end tag).

Examples

import std.array : appender;

auto writer = xmlWriter(appender!string());

writer.openStartTag("root", Newline.no);
assert(writer.output.data == "<root");

writer.closeStartTag();
assert(writer.output.data == "<root>");

writer.openStartTag("foo");
assert(writer.output.data ==
       "<root>\n" ~
       "    <foo");

writer.closeStartTag(EmptyTag.yes);
assert(writer.output.data ==
       "<root>\n" ~
       "    <foo/>");

writer.writeEndTag();
assert(writer.output.data ==
       "<root>\n" ~
       "    <foo/>\n" ~
       "</root>");

See Also

Meta