Skip to content

Commit aaaea5f

Browse files
committed
Update the documentation about mutable DOM.
1 parent 3081704 commit aaaea5f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Dart XML
99
[![GitHub Stars](https://img.shields.io/github/stars/renggli/dart-xml.svg)](https://github.com/renggli/dart-xml/stargazers)
1010
[![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/renggli/dart-xml/master/LICENSE)
1111

12-
Dart XML is a lightweight library for parsing, traversing, querying and building XML documents.
12+
Dart XML is a lightweight library for parsing, traversing, querying, transforming and building XML documents.
1313

1414
This library is open source, stable and well tested. Development happens on [GitHub](http://github.com/renggli/dart-xml). Feel free to report issues or create a pull-request there. General questions are best asked on [StackOverflow](http://stackoverflow.com/questions/tagged/xml+dart).
1515

@@ -51,18 +51,21 @@ var document = xml.parse(bookshelfXml);
5151

5252
The resulting object is an instance of `XmlDocument`. In case the document cannot be parsed, a `ParserError` is thrown.
5353

54-
To write back the parsed XML document simply call `toString()`:
54+
To write back the parsed XML document simply call `toString()`, if you need more control `toXmlString(petty: true, indent: '\t')`:
5555

5656
```dart
5757
print(document.toString());
58+
print(document.toXmlString(petty: true, indent: '\t'));
5859
```
5960

6061
### Traversing and Querying
6162

6263
Accessors allow to access nodes in the XML tree:
6364

64-
- `attributes` returns an iterable over the attributes of the current node.
65-
- `children` returns an iterable over the children of the current node.
65+
- `attributes` returns a list over the attributes of the current node.
66+
- `children` returns a list over the children of the current node.
67+
68+
Both lists are mutable and support all common `List` methods, such as `add(XmlNode)`, `addAll(Iterable<XmlNode>)`, `insert(int, XmlNode)`, and `insertAll(int, Iterable<XmlNode>)`. Trying to add a `null` value or an unsupported node type throws an `XmlNodeTypeError` error. Nodes that are already part of a tree _are not_ automatically moved, you need to first create a cope as otherwise an `XmlParentError` is thrown. `XmlDocumentFragment` nodes are automatically expanded and copies of their children are added.
6669

6770
There are various methods to traverse the XML tree along its axes:
6871

@@ -171,9 +174,9 @@ There are various open source projects using this package:
171174

172175
### Supports
173176

174-
- Standard well-formed XML and HTML.
177+
- Standard well-formed XML (and HTML).
175178
- Decodes and encodes commonly used character entities.
176-
- Querying and traversing API using Dart iterators.
179+
- Querying, traversing, and mutating API using Dart principles.
177180
- Building XML trees using a builder API.
178181

179182
### Limitations

0 commit comments

Comments
 (0)