xommelier 0.1.19 → 0.1.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/Rakefile +2 -2
  2. data/examples/atom.rb +3 -3
  3. data/lib/xommelier.rb +9 -0
  4. data/lib/xommelier/atom/links_extension.rb +12 -2
  5. data/lib/xommelier/atom/source.rb +12 -2
  6. data/lib/xommelier/core_ext/boolean.rb +1 -0
  7. data/lib/xommelier/core_ext/float.rb +1 -1
  8. data/lib/xommelier/core_ext/numeric.rb +1 -1
  9. data/lib/xommelier/core_ext/time.rb +9 -1
  10. data/lib/xommelier/core_ext/uri.rb +6 -2
  11. data/lib/xommelier/open_search.rb +55 -40
  12. data/lib/xommelier/rss.rb +51 -6
  13. data/lib/xommelier/rss/atomic.rb +21 -0
  14. data/lib/xommelier/schemas/dublincore/dc.xsd +118 -0
  15. data/lib/xommelier/schemas/dublincore/dcmitype.xsd +52 -0
  16. data/lib/xommelier/schemas/dublincore/dcterms.xsd +382 -0
  17. data/lib/xommelier/schemas/dublincore/qualifieddc.xsd +40 -0
  18. data/lib/xommelier/schemas/dublincore/simpledc.xsd +39 -0
  19. data/lib/xommelier/schemas/opensearch.xsd +484 -0
  20. data/lib/xommelier/schemas/syndication/creativeCommons.xsd +17 -0
  21. data/lib/xommelier/schemas/syndication/fh.xsd +19 -0
  22. data/lib/xommelier/schemas/syndication/schematron.xsd +254 -0
  23. data/lib/xommelier/schemas/syndication/thr.xsd +39 -0
  24. data/lib/xommelier/schemas/syndication/trackback.xsd +18 -0
  25. data/lib/xommelier/version.rb +1 -1
  26. data/lib/xommelier/xml/element.rb +1 -0
  27. data/lib/xommelier/xml/element/serialization.rb +12 -11
  28. data/lib/xommelier/xml/element/structure.rb +19 -19
  29. data/lib/xommelier/xml/element/structure/property.rb +4 -0
  30. data/spec/fixtures/opensearch.full.xml +23 -0
  31. data/spec/functional/xommelier/atom/feed/building_hash_spec.rb +37 -0
  32. data/spec/functional/xommelier/atom/feed/building_spec.rb +33 -0
  33. data/spec/functional/{atom_feed_parsing_spec.rb → xommelier/atom/feed/parsing_spec.rb} +3 -4
  34. data/spec/functional/{atom_feed_thread_building_spec.rb → xommelier/atom/threading/building_spec.rb} +0 -0
  35. data/spec/functional/xommelier/open_search/description/building_spec.rb +36 -0
  36. data/spec/functional/xommelier/open_search/description/parsing_spec.rb +47 -0
  37. data/spec/functional/{rss_feed_building_spec.rb → xommelier/rss/rss/building_spec.rb} +0 -0
  38. data/spec/functional/{rss_feed_parsing_spec.rb → xommelier/rss/rss/parsing_spec.rb} +0 -0
  39. data/spec/lib/xommelier/rss/email_address_spec.rb +22 -0
  40. data/spec/lib/xommelier/xml/element_spec.rb +2 -2
  41. data/spec/spec_helper.rb +1 -0
  42. data/xommelier.gemspec +8 -8
  43. metadata +34 -14
  44. data/spec/functional/atom_feed_building_spec.rb +0 -31
  45. data/spec/functional/build_nested_document_from_hash_spec.rb +0 -39
@@ -0,0 +1,52 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
3
+ xmlns="http://purl.org/dc/dcmitype/"
4
+ targetNamespace="http://purl.org/dc/dcmitype/"
5
+ elementFormDefault="qualified"
6
+ attributeFormDefault="unqualified">
7
+
8
+ <xs:annotation>
9
+ <xs:documentation xml:lang="en">
10
+ DCMI Type Vocabulary XML Schema
11
+ XML Schema for http://purl.org/dc/dcmitype/ namespace
12
+
13
+ Created 2008-02-11
14
+
15
+ Created by
16
+
17
+ Tim Cole (t-cole3@uiuc.edu)
18
+ Tom Habing (thabing@uiuc.edu)
19
+ Jane Hunter (jane@dstc.edu.au)
20
+ Pete Johnston (p.johnston@ukoln.ac.uk),
21
+ Carl Lagoze (lagoze@cs.cornell.edu)
22
+
23
+ This schema defines a simpleType which enumerates
24
+ the allowable values for the DCMI Type Vocabulary.
25
+ </xs:documentation>
26
+
27
+
28
+ </xs:annotation>
29
+
30
+
31
+ <xs:simpleType name="DCMIType">
32
+ <xs:union>
33
+ <xs:simpleType>
34
+ <xs:restriction base="xs:Name">
35
+ <xs:enumeration value="Collection"/>
36
+ <xs:enumeration value="Dataset"/>
37
+ <xs:enumeration value="Event"/>
38
+ <xs:enumeration value="Image"/>
39
+ <xs:enumeration value="MovingImage"/>
40
+ <xs:enumeration value="StillImage"/>
41
+ <xs:enumeration value="InteractiveResource"/>
42
+ <xs:enumeration value="Service"/>
43
+ <xs:enumeration value="Software"/>
44
+ <xs:enumeration value="Sound"/>
45
+ <xs:enumeration value="Text"/>
46
+ <xs:enumeration value="PhysicalObject"/>
47
+ </xs:restriction>
48
+ </xs:simpleType>
49
+ </xs:union>
50
+ </xs:simpleType>
51
+
52
+ </xs:schema>
@@ -0,0 +1,382 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:dcmitype="http://purl.org/dc/dcmitype/"
5
+ targetNamespace="http://purl.org/dc/terms/"
6
+ xmlns="http://purl.org/dc/terms/"
7
+ elementFormDefault="qualified"
8
+ attributeFormDefault="unqualified">
9
+
10
+ <xs:annotation>
11
+ <xs:documentation xml:lang="en">
12
+ DCterms XML Schema
13
+ XML Schema for http://purl.org/dc/terms/ namespace
14
+
15
+ Created 2008-02-11
16
+
17
+ Created by
18
+
19
+ Tim Cole (t-cole3@uiuc.edu)
20
+ Tom Habing (thabing@uiuc.edu)
21
+ Jane Hunter (jane@dstc.edu.au)
22
+ Pete Johnston (p.johnston@ukoln.ac.uk),
23
+ Carl Lagoze (lagoze@cs.cornell.edu)
24
+
25
+ This schema declares XML elements for the DC elements and
26
+ DC element refinements from the http://purl.org/dc/terms/ namespace.
27
+
28
+ It reuses the complexType dc:SimpleLiteral, imported from the dc.xsd
29
+ schema, which permits simple element content, and makes the xml:lang
30
+ attribute available.
31
+
32
+ This complexType permits the derivation of other complexTypes
33
+ which would permit child elements.
34
+
35
+ XML elements corresponding to DC elements are declared as substitutable for the abstract element dc:any, and
36
+ XML elements corresponding to DC element refinements are defined as substitutable for the base elements
37
+ which they refine.
38
+
39
+ This means that the default type for all XML elements (i.e. corresponding to all DC elements and
40
+ element refinements) is dc:SimpleLiteral.
41
+
42
+ Encoding schemes are defined as complexTypes which are restrictions
43
+ of the dc:SimpleLiteral complexType. These complexTypes restrict
44
+ values to an appropriates syntax or format using data typing,
45
+ regular expressions, or enumerated lists.
46
+
47
+ In order to specify one of these encodings an xsi:type attribute must
48
+ be used in the instance document.
49
+
50
+ Also, note that one shortcoming of this approach is that any type can be
51
+ applied to any of the elements or refinements. There is no convenient way
52
+ to restrict types to specific elements using this approach.
53
+
54
+ Changes in 2008-02-11 version:
55
+
56
+ Add element declarations corresponding to 15 new dcterms URIs, and amend use of substitutionGroups.
57
+
58
+ Add compexType definitions corresponding to ISO639-3, RFC4646.
59
+
60
+ </xs:documentation>
61
+
62
+ </xs:annotation>
63
+
64
+
65
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace"
66
+ schemaLocation="http://www.w3.org/2001/03/xml.xsd">
67
+ </xs:import>
68
+
69
+ <xs:import namespace="http://purl.org/dc/elements/1.1/"
70
+ schemaLocation="dc.xsd"/>
71
+
72
+ <xs:import namespace="http://purl.org/dc/dcmitype/"
73
+ schemaLocation="dcmitype.xsd"/>
74
+
75
+ <xs:element name="title" substitutionGroup="dc:title"/>
76
+ <xs:element name="creator" substitutionGroup="dc:creator"/>
77
+ <xs:element name="subject" substitutionGroup="dc:subject"/>
78
+ <xs:element name="description" substitutionGroup="dc:description"/>
79
+ <xs:element name="publisher" substitutionGroup="dc:publisher"/>
80
+ <xs:element name="contributor" substitutionGroup="dc:contributor"/>
81
+ <xs:element name="date" substitutionGroup="dc:date"/>
82
+ <xs:element name="type" substitutionGroup="dc:type"/>
83
+ <xs:element name="format" substitutionGroup="dc:format"/>
84
+ <xs:element name="identifier" substitutionGroup="dc:identifier"/>
85
+ <xs:element name="source" substitutionGroup="dc:source"/>
86
+ <xs:element name="language" substitutionGroup="dc:language"/>
87
+ <xs:element name="relation" substitutionGroup="dc:relation"/>
88
+ <xs:element name="coverage" substitutionGroup="dc:coverage"/>
89
+ <xs:element name="rights" substitutionGroup="dc:rights"/>
90
+
91
+ <xs:element name="alternative" substitutionGroup="title"/>
92
+
93
+ <xs:element name="tableOfContents" substitutionGroup="description"/>
94
+ <xs:element name="abstract" substitutionGroup="description"/>
95
+
96
+ <xs:element name="created" substitutionGroup="date"/>
97
+ <xs:element name="valid" substitutionGroup="date"/>
98
+ <xs:element name="available" substitutionGroup="date"/>
99
+ <xs:element name="issued" substitutionGroup="date"/>
100
+ <xs:element name="modified" substitutionGroup="date"/>
101
+ <xs:element name="dateAccepted" substitutionGroup="date"/>
102
+ <xs:element name="dateCopyrighted" substitutionGroup="date"/>
103
+ <xs:element name="dateSubmitted" substitutionGroup="date"/>
104
+
105
+ <xs:element name="extent" substitutionGroup="format"/>
106
+ <xs:element name="medium" substitutionGroup="format"/>
107
+
108
+ <xs:element name="isVersionOf" substitutionGroup="relation"/>
109
+ <xs:element name="hasVersion" substitutionGroup="relation"/>
110
+ <xs:element name="isReplacedBy" substitutionGroup="relation"/>
111
+ <xs:element name="replaces" substitutionGroup="relation"/>
112
+ <xs:element name="isRequiredBy" substitutionGroup="relation"/>
113
+ <xs:element name="requires" substitutionGroup="relation"/>
114
+ <xs:element name="isPartOf" substitutionGroup="relation"/>
115
+ <xs:element name="hasPart" substitutionGroup="relation"/>
116
+ <xs:element name="isReferencedBy" substitutionGroup="relation"/>
117
+ <xs:element name="references" substitutionGroup="relation"/>
118
+ <xs:element name="isFormatOf" substitutionGroup="relation"/>
119
+ <xs:element name="hasFormat" substitutionGroup="relation"/>
120
+ <xs:element name="conformsTo" substitutionGroup="relation"/>
121
+
122
+ <xs:element name="spatial" substitutionGroup="coverage"/>
123
+ <xs:element name="temporal" substitutionGroup="coverage"/>
124
+
125
+ <xs:element name="audience" substitutionGroup="dc:any"/>
126
+ <xs:element name="accrualMethod" substitutionGroup="dc:any"/>
127
+ <xs:element name="accrualPeriodicity" substitutionGroup="dc:any"/>
128
+ <xs:element name="accrualPolicy" substitutionGroup="dc:any"/>
129
+ <xs:element name="instructionalMethod" substitutionGroup="dc:any"/>
130
+ <xs:element name="provenance" substitutionGroup="dc:any"/>
131
+ <xs:element name="rightsHolder" substitutionGroup="dc:any"/>
132
+
133
+ <xs:element name="mediator" substitutionGroup="audience"/>
134
+ <xs:element name="educationLevel" substitutionGroup="audience"/>
135
+
136
+ <xs:element name="accessRights" substitutionGroup="rights"/>
137
+ <xs:element name="license" substitutionGroup="rights"/>
138
+
139
+ <xs:element name="bibliographicCitation" substitutionGroup="identifier"/>
140
+
141
+ <xs:complexType name="LCSH">
142
+ <xs:simpleContent>
143
+ <xs:restriction base="dc:SimpleLiteral">
144
+ <xs:simpleType>
145
+ <xs:restriction base="xs:string"/>
146
+ </xs:simpleType>
147
+ <xs:attribute ref="xml:lang" use="prohibited"/>
148
+ </xs:restriction>
149
+ </xs:simpleContent>
150
+ </xs:complexType>
151
+
152
+ <xs:complexType name="MESH">
153
+ <xs:simpleContent>
154
+ <xs:restriction base="dc:SimpleLiteral">
155
+ <xs:simpleType>
156
+ <xs:restriction base="xs:string"/>
157
+ </xs:simpleType>
158
+ <xs:attribute ref="xml:lang" use="prohibited"/>
159
+ </xs:restriction>
160
+ </xs:simpleContent>
161
+ </xs:complexType>
162
+
163
+ <xs:complexType name="DDC">
164
+ <xs:simpleContent>
165
+ <xs:restriction base="dc:SimpleLiteral">
166
+ <xs:simpleType>
167
+ <xs:restriction base="xs:string"/>
168
+ </xs:simpleType>
169
+ <xs:attribute ref="xml:lang" use="prohibited"/>
170
+ </xs:restriction>
171
+ </xs:simpleContent>
172
+ </xs:complexType>
173
+
174
+ <xs:complexType name="LCC">
175
+ <xs:simpleContent>
176
+ <xs:restriction base="dc:SimpleLiteral">
177
+ <xs:simpleType>
178
+ <xs:restriction base="xs:string"/>
179
+ </xs:simpleType>
180
+ <xs:attribute ref="xml:lang" use="prohibited"/>
181
+ </xs:restriction>
182
+ </xs:simpleContent>
183
+ </xs:complexType>
184
+
185
+ <xs:complexType name="UDC">
186
+ <xs:simpleContent>
187
+ <xs:restriction base="dc:SimpleLiteral">
188
+ <xs:simpleType>
189
+ <xs:restriction base="xs:string"/>
190
+ </xs:simpleType>
191
+ <xs:attribute ref="xml:lang" use="prohibited"/>
192
+ </xs:restriction>
193
+ </xs:simpleContent>
194
+ </xs:complexType>
195
+
196
+ <xs:complexType name="Period">
197
+ <xs:simpleContent>
198
+ <xs:restriction base="dc:SimpleLiteral">
199
+ <xs:simpleType>
200
+ <xs:restriction base="xs:string"/>
201
+ </xs:simpleType>
202
+ <xs:attribute ref="xml:lang" use="prohibited"/>
203
+ </xs:restriction>
204
+ </xs:simpleContent>
205
+ </xs:complexType>
206
+
207
+ <xs:complexType name="W3CDTF">
208
+ <xs:simpleContent>
209
+ <xs:restriction base="dc:SimpleLiteral">
210
+ <xs:simpleType>
211
+ <xs:union memberTypes="xs:gYear xs:gYearMonth xs:date xs:dateTime"/>
212
+ </xs:simpleType>
213
+ <xs:attribute ref="xml:lang" use="prohibited"/>
214
+ </xs:restriction>
215
+ </xs:simpleContent>
216
+ </xs:complexType>
217
+
218
+ <xs:complexType name="DCMIType">
219
+ <xs:simpleContent>
220
+ <xs:restriction base="dc:SimpleLiteral">
221
+ <xs:simpleType>
222
+ <xs:restriction base="dcmitype:DCMIType"/>
223
+ </xs:simpleType>
224
+ <xs:attribute ref="xml:lang" use="prohibited"/>
225
+ </xs:restriction>
226
+ </xs:simpleContent>
227
+ </xs:complexType>
228
+
229
+ <xs:complexType name="IMT">
230
+ <xs:simpleContent>
231
+ <xs:restriction base="dc:SimpleLiteral">
232
+ <xs:simpleType>
233
+ <xs:restriction base="xs:string"/>
234
+ </xs:simpleType>
235
+ <xs:attribute ref="xml:lang" use="prohibited"/>
236
+ </xs:restriction>
237
+ </xs:simpleContent>
238
+ </xs:complexType>
239
+
240
+ <xs:complexType name="URI">
241
+ <xs:simpleContent>
242
+ <xs:restriction base="dc:SimpleLiteral">
243
+ <xs:simpleType>
244
+ <xs:restriction base="xs:anyURI"/>
245
+ </xs:simpleType>
246
+ <xs:attribute ref="xml:lang" use="prohibited"/>
247
+ </xs:restriction>
248
+ </xs:simpleContent>
249
+ </xs:complexType>
250
+
251
+ <xs:complexType name="ISO639-2">
252
+ <xs:simpleContent>
253
+ <xs:restriction base="dc:SimpleLiteral">
254
+ <xs:simpleType>
255
+ <xs:restriction base="xs:string"/>
256
+ </xs:simpleType>
257
+ <xs:attribute ref="xml:lang" use="prohibited"/>
258
+ </xs:restriction>
259
+ </xs:simpleContent>
260
+ </xs:complexType>
261
+
262
+ <xs:complexType name="ISO639-3">
263
+ <xs:simpleContent>
264
+ <xs:restriction base="dc:SimpleLiteral">
265
+ <xs:simpleType>
266
+ <xs:restriction base="xs:string"/>
267
+ </xs:simpleType>
268
+ <xs:attribute ref="xml:lang" use="prohibited"/>
269
+ </xs:restriction>
270
+ </xs:simpleContent>
271
+ </xs:complexType>
272
+
273
+ <xs:complexType name="RFC1766">
274
+ <xs:simpleContent>
275
+ <xs:restriction base="dc:SimpleLiteral">
276
+ <xs:simpleType>
277
+ <xs:restriction base="xs:language"/>
278
+ </xs:simpleType>
279
+ <xs:attribute ref="xml:lang" use="prohibited"/>
280
+ </xs:restriction>
281
+ </xs:simpleContent>
282
+ </xs:complexType>
283
+
284
+ <xs:complexType name="RFC3066">
285
+ <xs:simpleContent>
286
+ <xs:restriction base="dc:SimpleLiteral">
287
+ <xs:simpleType>
288
+ <xs:restriction base="xs:language"/>
289
+ </xs:simpleType>
290
+ <xs:attribute ref="xml:lang" use="prohibited"/>
291
+ </xs:restriction>
292
+ </xs:simpleContent>
293
+ </xs:complexType>
294
+
295
+ <xs:complexType name="RFC4646">
296
+ <xs:simpleContent>
297
+ <xs:restriction base="dc:SimpleLiteral">
298
+ <xs:simpleType>
299
+ <xs:restriction base="xs:language"/>
300
+ </xs:simpleType>
301
+ <xs:attribute ref="xml:lang" use="prohibited"/>
302
+ </xs:restriction>
303
+ </xs:simpleContent>
304
+ </xs:complexType>
305
+
306
+ <xs:complexType name="Point">
307
+ <xs:simpleContent>
308
+ <xs:restriction base="dc:SimpleLiteral">
309
+ <xs:simpleType>
310
+ <xs:restriction base="xs:string"/>
311
+ </xs:simpleType>
312
+ <xs:attribute ref="xml:lang" use="prohibited"/>
313
+ </xs:restriction>
314
+ </xs:simpleContent>
315
+ </xs:complexType>
316
+
317
+ <xs:complexType name="ISO3166">
318
+ <xs:simpleContent>
319
+ <xs:restriction base="dc:SimpleLiteral">
320
+ <xs:simpleType>
321
+ <xs:restriction base="xs:string"/>
322
+ </xs:simpleType>
323
+ <xs:attribute ref="xml:lang" use="prohibited"/>
324
+ </xs:restriction>
325
+ </xs:simpleContent>
326
+ </xs:complexType>
327
+
328
+ <xs:complexType name="Box">
329
+ <xs:simpleContent>
330
+ <xs:restriction base="dc:SimpleLiteral">
331
+ <xs:simpleType>
332
+ <xs:restriction base="xs:string"/>
333
+ </xs:simpleType>
334
+ <xs:attribute ref="xml:lang" use="prohibited"/>
335
+ </xs:restriction>
336
+ </xs:simpleContent>
337
+ </xs:complexType>
338
+
339
+ <xs:complexType name="TGN">
340
+ <xs:simpleContent>
341
+ <xs:restriction base="dc:SimpleLiteral">
342
+ <xs:simpleType>
343
+ <xs:restriction base="xs:string"/>
344
+ </xs:simpleType>
345
+ <xs:attribute ref="xml:lang" use="prohibited"/>
346
+ </xs:restriction>
347
+ </xs:simpleContent>
348
+ </xs:complexType>
349
+
350
+ <xs:group name="elementsAndRefinementsGroup">
351
+ <xs:annotation>
352
+ <xs:documentation xml:lang="en">
353
+ This group is included as a convenience for schema authors
354
+ who need to refer to all the DC elements and element refinements
355
+ in the http://purl.org/dc/elements/1.1/ and
356
+ http://purl.org/dc/terms namespaces.
357
+ N.B. Refinements available via substitution groups.
358
+ </xs:documentation>
359
+ </xs:annotation>
360
+
361
+ <xs:sequence>
362
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
363
+ <xs:element ref="dc:any" />
364
+ </xs:choice>
365
+ </xs:sequence>
366
+ </xs:group>
367
+
368
+ <xs:complexType name="elementOrRefinementContainer">
369
+ <xs:annotation>
370
+ <xs:documentation xml:lang="en">
371
+ This is included as a convenience for schema authors who need to define a root
372
+ or container element for all of the DC elements and element refinements.
373
+ </xs:documentation>
374
+ </xs:annotation>
375
+
376
+ <xs:choice>
377
+ <xs:group ref="elementsAndRefinementsGroup"/>
378
+ </xs:choice>
379
+ </xs:complexType>
380
+
381
+
382
+ </xs:schema>
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
3
+ xmlns:dcterms="http://purl.org/dc/terms/"
4
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
5
+ elementFormDefault="qualified"
6
+ attributeFormDefault="unqualified">
7
+
8
+ <xs:annotation>
9
+ <xs:documentation xml:lang="en">
10
+ Qualified DC container XML Schema
11
+
12
+ Created 2008-02-11
13
+
14
+ Created by
15
+
16
+ Tim Cole (t-cole3@uiuc.edu)
17
+ Tom Habing (thabing@uiuc.edu)
18
+ Jane Hunter (jane@dstc.edu.au)
19
+ Pete Johnston (p.johnston@ukoln.ac.uk),
20
+ Carl Lagoze (lagoze@cs.cornell.edu)
21
+
22
+ This schema declares a container element for a Qualified DC application.
23
+
24
+ The declaration of the qualifieddc element uses the dcterms:elementOrRefinementContainer
25
+ complexType.
26
+
27
+ Note that this schema does not define a target namespace. The expectation is that
28
+ the qualifieddc element is assigned to a namespace by an application schema
29
+ which includes this schema.
30
+
31
+ </xs:documentation>
32
+
33
+ </xs:annotation>
34
+
35
+ <xs:import namespace="http://purl.org/dc/terms/"
36
+ schemaLocation="dcterms.xsd"/>
37
+
38
+ <xs:element name="qualifieddc" type="dcterms:elementOrRefinementContainer"/>
39
+
40
+ </xs:schema>