https://github.com/daniel-keogh/opml
A Dart package for parsing and building OPML documents
https://github.com/daniel-keogh/opml
dart dart-library dart-package dart2 dartlang opml opml-files opml-parser rss xml xml-parser xml-parsing
Last synced: 8 days ago
JSON representation
A Dart package for parsing and building OPML documents
- Host: GitHub
- URL: https://github.com/daniel-keogh/opml
- Owner: daniel-keogh
- License: mit
- Created: 2020-08-03T16:13:31.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-15T11:38:36.000Z (about 3 years ago)
- Last Synced: 2026-02-15T12:13:29.897Z (4 months ago)
- Topics: dart, dart-library, dart-package, dart2, dartlang, opml, opml-files, opml-parser, rss, xml, xml-parser, xml-parsing
- Language: Dart
- Homepage: https://pub.dev/packages/opml
- Size: 34.2 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# opml
[](https://pub.dartlang.org/packages/opml)
[](https://github.com/daniel-keogh/opml/actions/workflows/dart.yml)
[](https://opensource.org/licenses/MIT)
A Dart package for parsing and building [OPML](http://opml.org/spec2.opml) documents.
## Installing
Import the package into your Dart code using:
```dart
import 'package:opml/opml.dart';
```
## Examples
### Parsing XML
To parse XML input, use the `OpmlDocument.parse(String xmlString)` factory:
```dart
final xmlString = """
Example OPML Export
""";
final opml = OpmlDocument.parse(xmlString);
```
### Converting to XML
You can convert an `OpmlDocument` object to XML by first constructing the object and then calling `toXmlString()` on it.
```dart
final head = OpmlHeadBuilder().title('Example Export').build();
final body = [];
body.add(OpmlOutlineBuilder()
.text('World')
.title('World')
.addChild(OpmlOutlineBuilder()
.type('rss')
.text('BBC News - World')
.title('BBC News - World')
.xmlUrl('http://feeds.bbci.co.uk/news/world/rss.xml')
.build())
.addChild(OpmlOutlineBuilder()
.type('rss')
.text('World news | The Guardian')
.title('World news | The Guardian')
.xmlUrl('http://feeds.guardian.co.uk/theguardian/world/rss')
.build())
.build());
body.add(OpmlOutlineBuilder()
.text('Uncategorized')
.title('Uncategorized')
.build());
final opml = OpmlDocument(
head: head,
body: body,
);
final xml = opml.toXmlString(pretty: true);
print(xml);
```
## License
MIT