auto xml = "<root>\n" ~ " <foo>\n" ~ " Foo and bar. Always foo and bar...\n" ~ " </foo>\n" ~ "</root>"; auto range = parseXML(xml); assert(range.front.type == EntityType.elementStart); assert(range.front.name == "root"); assert(range.front.pos == TextPos(1, 1)); range.popFront(); assert(range.front.type == EntityType.elementStart); assert(range.front.name == "foo"); assert(range.front.pos == TextPos(2, 5)); range.popFront(); assert(range.front.type == EntityType.text); assert(range.front.text == "\n" ~ " Foo and bar. Always foo and bar...\n" ~ " "); assert(range.front.pos == TextPos(2, 10)); range.popFront(); assert(range.front.type == EntityType.elementEnd); assert(range.front.name == "foo"); assert(range.front.pos == TextPos(4, 5)); range.popFront(); assert(range.front.type == EntityType.elementEnd); assert(range.front.name == "root"); assert(range.front.pos == TextPos(5, 1)); range.popFront(); assert(range.empty);
The position in the the original text where the entity starts.