element method
Parser
element(
)
override
Implementation
@override
Parser element() => super.element().castList<dynamic>().map((list) {
final TName name = list[1];
final attributes = (list[2] as List).cast<TNode>();
if (list[4] == XmlToken.closeEndElement) {
return createElement(name, attributes, [], true);
} else {
final list4 = list[4] as List;
if (list[1] == list4[3]) {
final children = (list4[1] as List).cast<TNode>();
return createElement(
name, attributes, children, children.isNotEmpty);
} else {
final Token token = list4[2];
final lineAndColumn =
Token.lineAndColumnOf(token.buffer, token.start);
throw XmlParserException(
'Expected </${list[1]}>, but found </${list4[3]}>',
buffer: token.buffer,
position: token.start,
line: lineAndColumn[0],
column: lineAndColumn[1]);
}
}
});