enum configSplitYes = makeConfig(SplitEmpty.yes); { auto range = parseXML("<root></root>"); assert(range.front.type == EntityType.elementStart); assert(range.front.name == "root"); range.popFront(); assert(range.front.type == EntityType.elementEnd); assert(range.front.name == "root"); range.popFront(); assert(range.empty); } { // No difference if the tags are already split. auto range = parseXML!configSplitYes("<root></root>"); assert(range.front.type == EntityType.elementStart); assert(range.front.name == "root"); range.popFront(); assert(range.front.type == EntityType.elementEnd); assert(range.front.name == "root"); range.popFront(); assert(range.empty); } { // This treats <root></root> and <root/> as distinct. auto range = parseXML("<root/>"); assert(range.front.type == EntityType.elementEmpty); assert(range.front.name == "root"); range.popFront(); assert(range.empty); } { // This is parsed as if it were <root></root> insead of <root/>. auto range = parseXML!configSplitYes("<root/>"); assert(range.front.type == EntityType.elementStart); assert(range.front.name == "root"); range.popFront(); assert(range.front.type == EntityType.elementEnd); assert(range.front.name == "root"); range.popFront(); assert(range.empty); }
Whether the parser should report empty element tags as if they were a start tag followed by an end tag with nothing in between.
If splitEmpty == SplitEmpty.yes, then whenever an EntityType.elementEmpty is encountered, the parser will claim that that entity is an EntityType.elementStart, and then it will provide an EntityType.elementEnd as the next entity before the entity that actually follows it.
The purpose of this is to simplify the code using the parser, since most code does not care about the difference between an empty tag and a start and end tag with nothing in between. But since some code may care about the difference, the behavior is configurable.
Defaults to SplitEmpty.no.