I am trying to parse simple XML file like this:
<root>
<subroot>
<subsubroot>
test
</subsubroot>
</subroot>
</root>
I use following code for this:
#import('dart:core');
#import('dart:io');
class XMLParser {
parse( File file ) {
String xml = file.readAsTextSync();
xml = xml.trim();
//xml = xml.replaceAll("\n", "");
print(xml);
RegExp p = new RegExp("<([^<>]+)>(.*)</\\1>", true);
Iterable it = p.allMatches(xml);
print(it);
Iterator itt = it.iterator();
while( itt.hasNext() ) {
print(itt.next().group(0));
}
}
}
main() {
new XMLParser().parse(new File("test.xml"));
}
It looks like it does not work even for multiline parameter set to true. When I remove all newline symbols from the file it is ok.
Am I doing something wrong or is it a time to report a bug :)?