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.
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.
- json_schema_builder
Build and validate JSON Schemas in Dart with a fluent, type‑safe API
87Compare - jiffy
Parse, manipulate, query, and format dates and times in Dart and Flutter.
70Compare - xpath_selector
XPath package for HTML and XML parsing with basic XPath syntax support.
48Compare
Works with
Packages commonly used together with xml: ones it builds on, ones built on it, and its own family.
- petitparserxml depends on itBuild fast, composable, and type-safe grammars and parsers in plain Dart code.
- argsxml depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- dbusBuilt on xmlNative Dart D-Bus client for Linux and Windows.
- vector_graphics_compilerBuilt on xmlA compiler to convert SVGs to the binary format used by package:vector_graphics.
- pdfBuilt on xmlA PDF generation library for Dart and Flutter using a widget-like layout system.
- flutter_native_splashBuilt on xmlAutomatically generates native iOS, Android, and Web splash screens.
- melosBuilt on xmlA tool for managing Dart and Flutter monorepos with script execution, versioning, and publishing.
- excelBuilt on xmlRead, create, edit and write XLSX Excel files in Dart/Flutter.