Skip to content
pubscout

xml

7.1.0, released 8 weeks ago by lukas-renggli.ch

Full-featured XML and XPath library for DOM parsing, SAX streaming, and fluent building.

WASM-ready
$ flutter pub add xml
Source repository

What it does

Dart XML provides tools for parsing, traversing, querying via XPath 3.1, and building XML documents. It supports both in-memory DOM manipulation and memory-efficient event-driven SAX streaming.

AI-written summary of version 7.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to parse, query, or manipulate XML documents in Dart or Flutter.
  • You require XPath 3.1 support for complex document queries.
  • You need to process large XML streams efficiently without buffering the entire tree.

Skip it when

  • You need strict XML Schema (XSD) validation built directly into the parser.
  • You require full XSLT transformations or complex XQuery modules.

Strengths

  • Comprehensive W3C XPath 3.1 implementation and DOM model.
  • Supports both pull- and push-based event-driven SAX streaming.
  • Zero overhead and fully portable across Dart VM, Flutter, and Web.

Weaknesses

  • Does not validate documents against XML Schema (XSD) definitions.
  • External DTD entity resolution and validation are not enforced.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4
import 'package:xml/xml.dart';

final bookshelfXml = '''<?xml version="1.0"?>
<bookshelf>
  <book>
    <title lang="en">Growing a Language</title>
    <price>29.99</price>
  </book>
</bookshelf>''';

final document = XmlDocument.parse(bookshelfXml);

Alternatives

Packages that do the same job and could replace xml.

Works with

Packages commonly used together with xml: ones it builds on, ones built on it, and its own family.