XMLWriter._writeStartTag

Undocumented in source. Be warned that the author may not have intended to support it.
struct XMLWriter(OR)
void
_writeStartTag
if (
isOutputRange!(OR, char)
)

Examples

import std.array : appender;
import std.exception : assertThrown;

auto writer = xmlWriter(appender!string());
writer.writeStartTag("root", Newline.no);
assert(writer.output.data == "<root>");

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

// = is not legal in a tag name.
assertThrown!XMLWritingException(writer.writeStartTag("="));

// Unchanged after an XMLWritingException is thrown.
assert(writer.output.data ==
       "<root>\n" ~
       "    <foo>");

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

writer.writeStartTag("baz", EmptyTag.yes, Newline.no);
assert(writer.output.data ==
       "<root>\n" ~
       "    <foo>\n" ~
       "        <bar/><baz/>");

writer.writeStartTag("bloop");
assert(writer.output.data ==
       "<root>\n" ~
       "    <foo>\n" ~
       "        <bar/><baz/>\n" ~
       "        <bloop>");

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

Meta