|
9 | 9 | [](https://github.com/renggli/dart-xml/stargazers)
|
10 | 10 | [](https://raw.githubusercontent.com/renggli/dart-xml/master/LICENSE)
|
11 | 11 |
|
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. |
13 | 13 |
|
14 | 14 | 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).
|
15 | 15 |
|
@@ -51,18 +51,21 @@ var document = xml.parse(bookshelfXml);
|
51 | 51 |
|
52 | 52 | The resulting object is an instance of `XmlDocument`. In case the document cannot be parsed, a `ParserError` is thrown.
|
53 | 53 |
|
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')`: |
55 | 55 |
|
56 | 56 | ```dart
|
57 | 57 | print(document.toString());
|
| 58 | +print(document.toXmlString(petty: true, indent: '\t')); |
58 | 59 | ```
|
59 | 60 |
|
60 | 61 | ### Traversing and Querying
|
61 | 62 |
|
62 | 63 | Accessors allow to access nodes in the XML tree:
|
63 | 64 |
|
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. |
66 | 69 |
|
67 | 70 | There are various methods to traverse the XML tree along its axes:
|
68 | 71 |
|
@@ -171,9 +174,9 @@ There are various open source projects using this package:
|
171 | 174 |
|
172 | 175 | ### Supports
|
173 | 176 |
|
174 |
| -- Standard well-formed XML and HTML. |
| 177 | +- Standard well-formed XML (and HTML). |
175 | 178 | - Decodes and encodes commonly used character entities.
|
176 |
| -- Querying and traversing API using Dart iterators. |
| 179 | +- Querying, traversing, and mutating API using Dart principles. |
177 | 180 | - Building XML trees using a builder API.
|
178 | 181 |
|
179 | 182 | ### Limitations
|
|
0 commit comments