Read XML file in Dart

Viewed 14676

I'm new in Dart language.

I'm wanting to read a XML file and I'm following these links (they are practical the same) https://pub.dartlang.org/packages/xml or the github's page https://github.com/renggli/dart-xml.

But I'm having problems with some methods like "findAllElements". I'm importing in my dart file the xml library that they have and importing the collection, core and html:

library xml;    
import 'dart:collection';
import 'dart:core';
import 'dart:html';

My code is:

  var document = responseText;

  var titles = document.findAllElements('trkpt');

  titles
      .map((node) => node.text)
      .forEach(print);

While I test my program I have this error:

NoSuchMethodError: method not found: 'findAllElements'

What do I need to import more? I'm still exploring this language and my goal is just get data from XML and apply a filter for it! Any tutorial? Any suggestion?

1 Answers
Related