DOMEntity.name

Gives the name of this DOMEntity.

Note that this is the direct name in the XML for this entity and does not contain any of the names of any of the parent entities that this entity has.

Supported EntityTypes:
elementStart
elementEnd
elementEmpty
pi
struct DOMEntity(R)
@property
name
(
)

Examples

1 import std.range.primitives : empty;
2 
3 auto xml = "<root>\n" ~
4            "    <empty/>\n" ~
5            "    <?pi?>\n" ~
6            "</root>";
7 
8 auto dom = parseDOM(xml);
9 assert(dom.type == EntityType.elementStart);
10 assert(dom.name.empty);
11 
12 auto root = dom.children[0];
13 assert(root.type == EntityType.elementStart);
14 assert(root.name == "root");
15 
16 assert(root.children[0].type == EntityType.elementEmpty);
17 assert(root.children[0].name == "empty");
18 
19 assert(root.children[1].type == EntityType.pi);
20 assert(root.children[1].name == "pi");

See Also

Meta