Name to check against the matching start tag.
Whether a _newline followed by an indent will be written to the output range before the end tag.
XMLWritingException if no start tag is waiting for a matching end tag or if the given _name does not match the _name of the start tag that needs to be matched next.
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>"); // Name doesn't match start tag, which is <foo>. assertThrown!XMLWritingException(writer.writeEndTag("bar")); // Unchanged after an XMLWritingException is thrown. assert(writer.output.data == "<root>\n" ~ " <foo>"); writer.writeEndTag("foo", Newline.no); assert(writer.output.data == "<root>\n" ~ " <foo></foo>"); writer.writeStartTag("bar"); assert(writer.output.data == "<root>\n" ~ " <foo></foo>\n" ~ " <bar>"); writer.writeEndTag("bar"); assert(writer.output.data == "<root>\n" ~ " <foo></foo>\n" ~ " <bar>\n" ~ " </bar>"); // No name is required, but if it is not provided, then the code cannot // validate that it's writing the end tag that it thinks it's writing. writer.writeEndTag(); assert(writer.output.data == "<root>\n" ~ " <foo></foo>\n" ~ " <bar>\n" ~ " </bar>\n" ~ "</root>");
Writes an end tag to the output range with the name of the start tag that was most recently written and does not yet have a matching end tag.
If a name is provided, then it will be validated against the matching start tag.