xommelier 0.1.25 → 0.1.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWZjZTQyMmJhODE1ZDYxNTViYWIxMmNlNGE5MzQ4YWU4NWYwMjQ0Yg==
4
+ Nzg4Y2NjMTQ3NDQxNzA3YWRmMTEwN2JjZWQ1MWY4ZDJjZGM5NTEwYw==
5
5
  data.tar.gz: !binary |-
6
- OTVkZDQ4NzViOWYzMTUzNDFkOGU1NDI0NTQ5NjAzODA5MmFmYTcwNw==
6
+ NGY5ZTFjNDNkMGNkZjgwMzFmNzdlNzFhZjJiY2JjOGE0ZTc4ODM4ZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTE2MWJiOTUyNjk2Y2MzMWI3MmEzMzk3ODI4ZThlOGEyZTBmZDI0ODc1Njcy
10
- NjY2NzUzNGU1MzYxMWM5ZTU0ZjBhYmVlYzQwYzQ5OTE3NWEyY2YwY2JmMDc0
11
- MDJiMDM0MzY3YzE3ODU5NzY4ZDY1MzBmMmRiYmM0NmYxMDRkZWE=
9
+ MGVmMDBkN2I1NzczYjM2YzZlZWNkNzgzYzdjYjBlZDM2OWUxYTk5YTUzNjlm
10
+ ZDI0NzQ0Mjg4NmY5MTQ3MWI5NDA2NjhiMjZhYzIwMWE1ODJhZjA5NDA2MDdh
11
+ NTcxNjA0M2EyODM5YmU2NjRjODg4OTBiMDY2NDM4YmYyYzAyNDE=
12
12
  data.tar.gz: !binary |-
13
- NTk3NGYxMzFhNTg5OGUwZDdmNGY2NTBlOGNkYTNmODUzMmJkMjM1NDkyMmEy
14
- ODQzY2U2NmViMDBhZjE4OWI5NzRjMmU0ZGMwODU3OWVlMWUzNzFkNzgwOTVi
15
- MTdiNzM5MTAwZGI3N2QwN2YyMTY2N2ViMzUzMmRhODQ3NGNjYzA=
13
+ YWE5ZmJlMTc1NWQ0MzAxYTdjOGM0YjRmZWNmMWRjNWVhOTNlODFjNTU3MGZk
14
+ NzhiOTMwYmZiY2Y2ZjM3MWMwOGViODEzYmY0MDZhOTdhMWVhMWVmMTgzY2Jm
15
+ MjQ3NjRlNDc2NWM2ZGYwMDhmMzRhMWY2NmM3M2Q1YzE5NDE5ZDE=
@@ -1,17 +1,19 @@
1
1
  <?xml version="1.0" encoding="utf-8" ?>
2
2
  <?xml-stylesheet href="xsd.xsl" type="text/xsl"?>
3
3
  <xs:schema targetNamespace="http://www.w3.org/2005/Atom" elementFormDefault="qualified"
4
- attributeFormDefault="unqualified"
5
- xmlns:atom="http://www.w3.org/2005/Atom"
6
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
7
- xmlns:xml="http://www.w3.org/XML/1998/namespace">
4
+ attributeFormDefault="unqualified"
5
+ xmlns:atom="http://www.w3.org/2005/Atom"
6
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
7
+ >
8
8
  <xs:annotation>
9
9
  <xs:documentation>
10
10
  This version of the Atom schema is based on version 1.0 of the format specifications,
11
11
  found here http://www.atomenabled.org/developers/syndication/atom-format-spec.php.
12
12
  </xs:documentation>
13
13
  </xs:annotation>
14
- <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd" />
14
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd" />
15
+ <xs:import namespace="http://purl.org/syndication/thread/1.0" schemaLocation="syndication/thr.xsd" />
16
+ <xs:import namespace="http://purl.org/syndication/history/1.0" schemaLocation="syndication/fh.xsd" />
15
17
  <xs:annotation>
16
18
  <xs:documentation>
17
19
  An Atom document may have two root elements, feed and entry, as defined in section 2.
@@ -12,7 +12,7 @@
12
12
 
13
13
  Created 2008-02-11
14
14
 
15
- Created by
15
+ Created by
16
16
 
17
17
  Tim Cole (t-cole3@uiuc.edu)
18
18
  Tom Habing (thabing@uiuc.edu)
@@ -23,14 +23,14 @@
23
23
  This schema declares XML elements for the 15 DC elements from the
24
24
  http://purl.org/dc/elements/1.1/ namespace.
25
25
 
26
- It defines a complexType SimpleLiteral which permits mixed content
26
+ It defines a complexType SimpleLiteral which permits mixed content
27
27
  and makes the xml:lang attribute available. It disallows child elements by
28
28
  use of minOcccurs/maxOccurs.
29
29
 
30
30
  However, this complexType does permit the derivation of other complexTypes
31
31
  which would permit child elements.
32
32
 
33
- All elements are declared as substitutable for the abstract element any,
33
+ All elements are declared as substitutable for the abstract element any,
34
34
  which means that the default type for all elements is dc:SimpleLiteral.
35
35
 
36
36
  </xs:documentation>
@@ -39,7 +39,7 @@
39
39
 
40
40
 
41
41
  <xs:import namespace="http://www.w3.org/XML/1998/namespace"
42
- schemaLocation="http://www.w3.org/2001/03/xml.xsd">
42
+ schemaLocation="../xml.xsd">
43
43
  </xs:import>
44
44
 
45
45
  <xs:complexType name="SimpleLiteral">
@@ -49,7 +49,7 @@
49
49
  It permits text content only with optional
50
50
  xml:lang attribute.
51
51
  Text is allowed because mixed="true", but sub-elements
52
- are disallowed because minOccurs="0" and maxOccurs="0"
52
+ are disallowed because minOccurs="0" and maxOccurs="0"
53
53
  are on the xs:any tag.
54
54
 
55
55
  This complexType allows for restriction or extension permitting
@@ -89,7 +89,7 @@
89
89
  <xs:annotation>
90
90
  <xs:documentation xml:lang="en">
91
91
  This group is included as a convenience for schema authors
92
- who need to refer to all the elements in the
92
+ who need to refer to all the elements in the
93
93
  http://purl.org/dc/elements/1.1/ namespace.
94
94
  </xs:documentation>
95
95
  </xs:annotation>
@@ -11,10 +11,10 @@
11
11
  <xs:documentation xml:lang="en">
12
12
  DCterms XML Schema
13
13
  XML Schema for http://purl.org/dc/terms/ namespace
14
-
14
+
15
15
  Created 2008-02-11
16
16
 
17
- Created by
17
+ Created by
18
18
 
19
19
  Tim Cole (t-cole3@uiuc.edu)
20
20
  Tom Habing (thabing@uiuc.edu)
@@ -24,7 +24,7 @@
24
24
 
25
25
  This schema declares XML elements for the DC elements and
26
26
  DC element refinements from the http://purl.org/dc/terms/ namespace.
27
-
27
+
28
28
  It reuses the complexType dc:SimpleLiteral, imported from the dc.xsd
29
29
  schema, which permits simple element content, and makes the xml:lang
30
30
  attribute available.
@@ -32,38 +32,38 @@
32
32
  This complexType permits the derivation of other complexTypes
33
33
  which would permit child elements.
34
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
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
37
  which they refine.
38
38
 
39
- This means that the default type for all XML elements (i.e. corresponding to all DC elements and
39
+ This means that the default type for all XML elements (i.e. corresponding to all DC elements and
40
40
  element refinements) is dc:SimpleLiteral.
41
41
 
42
42
  Encoding schemes are defined as complexTypes which are restrictions
43
- of the dc:SimpleLiteral complexType. These complexTypes restrict
43
+ of the dc:SimpleLiteral complexType. These complexTypes restrict
44
44
  values to an appropriates syntax or format using data typing,
45
45
  regular expressions, or enumerated lists.
46
-
47
- In order to specify one of these encodings an xsi:type attribute must
46
+
47
+ In order to specify one of these encodings an xsi:type attribute must
48
48
  be used in the instance document.
49
49
 
50
- Also, note that one shortcoming of this approach is that any type can be
50
+ Also, note that one shortcoming of this approach is that any type can be
51
51
  applied to any of the elements or refinements. There is no convenient way
52
52
  to restrict types to specific elements using this approach.
53
53
 
54
54
  Changes in 2008-02-11 version:
55
-
55
+
56
56
  Add element declarations corresponding to 15 new dcterms URIs, and amend use of substitutionGroups.
57
-
57
+
58
58
  Add compexType definitions corresponding to ISO639-3, RFC4646.
59
-
59
+
60
60
  </xs:documentation>
61
61
 
62
62
  </xs:annotation>
63
63
 
64
64
 
65
65
  <xs:import namespace="http://www.w3.org/XML/1998/namespace"
66
- schemaLocation="http://www.w3.org/2001/03/xml.xsd">
66
+ schemaLocation="../xml.xsd">
67
67
  </xs:import>
68
68
 
69
69
  <xs:import namespace="http://purl.org/dc/elements/1.1/"
@@ -213,7 +213,7 @@
213
213
  <xs:attribute ref="xml:lang" use="prohibited"/>
214
214
  </xs:restriction>
215
215
  </xs:simpleContent>
216
- </xs:complexType>
216
+ </xs:complexType>
217
217
 
218
218
  <xs:complexType name="DCMIType">
219
219
  <xs:simpleContent>
@@ -246,7 +246,7 @@
246
246
  <xs:attribute ref="xml:lang" use="prohibited"/>
247
247
  </xs:restriction>
248
248
  </xs:simpleContent>
249
- </xs:complexType>
249
+ </xs:complexType>
250
250
 
251
251
  <xs:complexType name="ISO639-2">
252
252
  <xs:simpleContent>
@@ -351,9 +351,9 @@
351
351
  <xs:annotation>
352
352
  <xs:documentation xml:lang="en">
353
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.
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
357
  N.B. Refinements available via substitution groups.
358
358
  </xs:documentation>
359
359
  </xs:annotation>
@@ -363,7 +363,7 @@
363
363
  <xs:element ref="dc:any" />
364
364
  </xs:choice>
365
365
  </xs:sequence>
366
- </xs:group>
366
+ </xs:group>
367
367
 
368
368
  <xs:complexType name="elementOrRefinementContainer">
369
369
  <xs:annotation>
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!-- schemaVersion of 2001/02/15 -->
3
3
  <xs:schema targetNamespace="http://www.ascc.net/xml/schematron" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns="http://www.ascc.net/xml/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="+//IDN sinica.edu.tw//SGML W3C XML Schema for Schematron 1.5//EN">
4
- <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
4
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="../xml.xsd">
5
5
  <xs:annotation>
6
6
  <xs:documentation>
7
7
  Get access to the xml: attribute groups for xml:lang
@@ -1,3 +1,3 @@
1
1
  module Xommelier
2
- VERSION = '0.1.25'
2
+ VERSION = '0.1.26'
3
3
  end
@@ -64,8 +64,7 @@ module Xommelier
64
64
  @schema_validation_errors = []
65
65
  schema = self.class.schema
66
66
  if schema
67
- document = ensure_xml_document
68
- document = Nokogiri::XML(to_xml)
67
+ document = Nokogiri::XML(ensure_xml_document.to_s)
69
68
  schema.validate(document).each do |error|
70
69
  @schema_validation_errors << error
71
70
  end
@@ -33,5 +33,6 @@ describe Xommelier::Atom::Feed do
33
33
 
34
34
  its(:to_hash) { should == hash}
35
35
  its(:to_xml) { should == load_xml_file('nested_atom') }
36
+ it_behaves_like 'Valid XML Document'
36
37
  end
37
38
  end
@@ -24,7 +24,7 @@ describe Xommelier::Atom::Feed do
24
24
  let(:rng) { Nokogiri::XML::RelaxNG(load_xml_file('atom.rng')) }
25
25
  let(:xsd) { Xommelier::Atom.schema }
26
26
 
27
- it { should be_valid }
27
+ it_behaves_like 'Valid XML Document'
28
28
 
29
29
  its(:to_xml) { should == load_xml_file('simple_feed.atom') }
30
30
  it('should conform to RelaxNG schema') { rng.valid?(parsed_xml).should == true }
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  require 'xommelier/atom/full'
3
3
 
4
4
  describe 'Atom feed building' do
5
- let(:feed) do
5
+ subject(:feed) do
6
6
  Xommelier::Atom::Feed.new.tap do |feed|
7
7
  feed.id = 'urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'
8
8
  feed.title = 'Example Feed'
@@ -33,8 +33,7 @@ describe 'Atom feed building' do
33
33
  let(:rng) { Nokogiri::XML::RelaxNG(load_xml_file('atom.rng')) }
34
34
  let(:xsd) { Nokogiri::XML::Schema(load_xml_file('atom.xsd')) }
35
35
 
36
- subject { built_xml }
37
-
38
- it { should == load_xml_file('multi_namespace_feed.atom') }
36
+ its(:to_xml) { should == load_xml_file('multi_namespace_feed.atom') }
39
37
  it('should conform to RelaxNG schema') { rng.valid?(parsed_xml).should == true }
38
+ it_behaves_like 'Valid XML Document'
40
39
  end
@@ -30,7 +30,7 @@ describe Xommelier::OpenSearch::Description do
30
30
  subject(:description) { Xommelier::OpenSearch::Description.new(hash) }
31
31
 
32
32
  its(:to_hash) { should == hash }
33
- it { should be_valid }
33
+ it_behaves_like 'Valid XML Document'
34
34
  its(:to_xml) { should == load_xml_file('opensearch.full') }
35
35
  end
36
36
  end
@@ -20,7 +20,6 @@ describe 'RSS feed building' do
20
20
  )
21
21
  end
22
22
 
23
- it { subject.class.schema.should be_present }
24
- it { should be_valid }
23
+ it_behaves_like 'Valid XML Document'
25
24
  its(:to_xml) { should == load_xml_file('simple_feed.rss') }
26
25
  end
@@ -0,0 +1,12 @@
1
+ shared_examples 'Valid XML Document' do
2
+ it { subject.class.schema.should be_present }
3
+ specify do
4
+ begin
5
+ should be_valid
6
+ rescue RSpec::Expectations::ExpectationNotMetError => e
7
+ puts subject.to_xml
8
+ puts subject.schema_validation_errors
9
+ raise e
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xommelier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.25
4
+ version: 0.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Semyonov
@@ -194,6 +194,7 @@ files:
194
194
  - spec/namespaced_module.rb
195
195
  - spec/spec_helper.rb
196
196
  - spec/support/fixtures.rb
197
+ - spec/support/schema_validatable.rb
197
198
  - xommelier.gemspec
198
199
  homepage: http://github.com/alsemyonov/xommelier
199
200
  licenses: []
@@ -246,3 +247,4 @@ test_files:
246
247
  - spec/namespaced_module.rb
247
248
  - spec/spec_helper.rb
248
249
  - spec/support/fixtures.rb
250
+ - spec/support/schema_validatable.rb