@@ -2,39 +2,46 @@ import 'package:webfeed/domain/atom_category.dart';
2
2
import 'package:webfeed/domain/atom_link.dart' ;
3
3
import 'package:webfeed/domain/atom_person.dart' ;
4
4
import 'package:webfeed/domain/atom_source.dart' ;
5
+ import 'package:webfeed/domain/media/media.dart' ;
5
6
import 'package:webfeed/util/helpers.dart' ;
6
7
import 'package:xml/xml.dart' ;
7
8
8
9
class AtomItem {
9
- String id;
10
- String title;
11
- String updated;
10
+ final String id;
11
+ final String title;
12
+ final String updated;
12
13
13
- List <AtomPerson > authors;
14
- List <AtomLink > links;
15
- List <AtomCategory > categories;
16
- List <AtomPerson > contributors;
17
- AtomSource source;
18
- String published;
19
- String content;
20
- String summary;
21
- String rights;
14
+ final List <AtomPerson > authors;
15
+ final List <AtomLink > links;
16
+ final List <AtomCategory > categories;
17
+ final List <AtomPerson > contributors;
18
+ final AtomSource source;
19
+ final String published;
20
+ final String content;
21
+ final String summary;
22
+ final String rights;
23
+ final Media media;
22
24
23
- AtomItem (this .id, this .title, this .updated,
24
- {this .authors,
25
- this .links,
26
- this .categories,
27
- this .contributors,
28
- this .source,
29
- this .published,
30
- this .content,
31
- this .summary,
32
- this .rights});
25
+ AtomItem ({
26
+ this .id,
27
+ this .title,
28
+ this .updated,
29
+ this .authors,
30
+ this .links,
31
+ this .categories,
32
+ this .contributors,
33
+ this .source,
34
+ this .published,
35
+ this .content,
36
+ this .summary,
37
+ this .rights,
38
+ this .media,
39
+ });
33
40
34
41
factory AtomItem .parse (XmlElement element) {
35
- var id = xmlGetString (element, "id" );
36
- var title = xmlGetString (element, "title" );
37
- var updated = xmlGetString (element, "updated" );
42
+ var id = xmlGetString (element, "id" , strict : false );
43
+ var title = xmlGetString (element, "title" , strict : false );
44
+ var updated = xmlGetString (element, "updated" , strict : false );
38
45
39
46
var authors = element.findElements ("author" ).map ((element) {
40
47
return new AtomPerson .parse (element);
@@ -62,16 +69,21 @@ class AtomItem {
62
69
var summary = xmlGetString (element, "summary" , strict: false );
63
70
var rights = xmlGetString (element, "rights" , strict: false );
64
71
65
- return new AtomItem (id, title, updated,
66
- authors: authors,
67
- links: links,
68
- categories: categories,
69
- contributors: contributors,
70
- source: source,
71
- published: published,
72
- content: content,
73
- summary: summary,
74
- rights: rights);
72
+ return new AtomItem (
73
+ id: id,
74
+ title: title,
75
+ updated: updated,
76
+ authors: authors,
77
+ links: links,
78
+ categories: categories,
79
+ contributors: contributors,
80
+ source: source,
81
+ published: published,
82
+ content: content,
83
+ summary: summary,
84
+ rights: rights,
85
+ media: new Media .parse (element),
86
+ );
75
87
}
76
88
77
89
@override
0 commit comments