renggli / dart-xml

Lightweight library for parsing, traversing, and transforming XML in Dart.
http://pub.dartlang.org/packages/xml
MIT License
223 stars 52 forks source link

XmlDocument.parse accepts invalid documents in version 6 #143

Closed robert-ancell closed 2 years ago

robert-ancell commented 2 years ago

Previously the following would throw XmlParserException, however in version 6 neither do.

XmlDocument.parse('');
XmlDocument.parse('foo');

Based on the documentation I would expect these to throw exceptions as the input is not valid XML.

renggli commented 2 years ago

Thanks for reporting, yeah that behavior got lost when transitioning to the stream-based parsing. I will look at adding the missing errors back (0 or more than 1 root elements).

renggli commented 2 years ago

Wondering if the DOM parser should also check the ordering of the declaration, doctype and root element (it currently doesn't)?

robert-ancell commented 2 years ago

Is it possible to make a release with this fix? I'd like to update dbus.dart.

swenhancer commented 2 years ago

+1 for making a release with this fix.

MattCCC commented 2 years ago

Hello, thank you for a great plugin. Any possibility to publish 6.0.2?

renggli commented 2 years ago

I published 6.1.0.