-
Does this library expect and validate some XML specific features such as RSS (correct me if I'm wrong) are valid XMLs. Some RSS feeds, however, oddly don't provide Would it continue parsing or would it throw an error? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, that example works just fine: import 'dart:convert';
import 'dart:io';
import 'package:xml/xml.dart';
Future<void> main(List<String> arguments) async {
final url = Uri.parse('https://evrimagaci.org/rss.xml');
final request = await HttpClient().getUrl(url);
final response = await request.close();
final input = await response.transform(utf8.decoder).join();
final document = XmlDocument.parse(input);
print(document.toXmlString(pretty: true));
} The XML declaration is optional according to the standard, so this library doesn't require it. |
Beta Was this translation helpful? Give feedback.
Yes, that example works just fine:
The XML declaration is optional according to the standard, so this library doesn't require it.
XmlDocument.parse
is very strict with XML that does not follow the standard and throws anXmlParserException
, i.e. when the tags are not …