ruby3mf 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,13 @@
1
1
  class Model3mf
2
2
 
3
+ MATERIAL_EXTENSION = 'http://schemas.microsoft.com/3dmanufacturing/material/2015/02'
4
+ SLICE_EXTENSION = 'http://schemas.microsoft.com/3dmanufacturing/slice/2015/07'
5
+ PRODUCTION_EXTENSION = 'http://schemas.microsoft.com/3dmanufacturing/production/2015/06'
6
+
3
7
  VALID_EXTENSIONS = {
4
- 'http://schemas.microsoft.com/3dmanufacturing/slice/2015/07' => {},
5
- 'http://schemas.microsoft.com/3dmanufacturing/material/2015/02' => {},
6
- 'http://schemas.microsoft.com/3dmanufacturing/production/2015/06' => {},
8
+ MATERIAL_EXTENSION => {},
9
+ SLICE_EXTENSION => {},
10
+ PRODUCTION_EXTENSION => {}
7
11
  }.freeze
8
12
 
9
13
  VALID_CORE_METADATA_NAMES = ['Title', 'Designer', 'Description', 'Copyright', 'LicenseTerms', 'Rating', 'CreationDate', 'ModificationDate'].freeze
@@ -58,22 +62,6 @@ class Model3mf
58
62
  }
59
63
  end
60
64
 
61
- l.context "verifying 3D resource types" do |l|
62
- model_types = model_doc.css("//model//resources//*[path]").collect { |t| t["contenttype"] }
63
-
64
- #for each, ensure they exist in ContentTypes
65
- all_types = document.types.map { |t, v| v }
66
-
67
- bad_types = (model_types - all_types)
68
- if bad_types.empty?
69
- l.info "All model resource contenttypes are valid"
70
- else
71
- bad_types.each { |bt|
72
- l.error :resource_contentype_invalid, bt: bt
73
- }
74
- end
75
- end
76
-
77
65
  l.context "verifying StartPart relationship points to the root 3D Model" do |l|
78
66
  #Find the root 3D model which is pointed to by the start part
79
67
  root_rels = document.relationships['_rels/.rels']
@@ -104,18 +92,9 @@ class Model3mf
104
92
  end
105
93
 
106
94
  l.context "verifying build items" do |l|
107
- build = find_child(model_doc.root, "build")
108
- if build
109
- items = build.children.map { |child| child.attributes["objectid"].to_s() if child.name == "item" }
110
-
111
- resources = find_child(model_doc.root, "resources")
112
- resources.children.each do |resource|
113
- if resource.name == "object"
114
- object_id = resource.attributes["id"].to_s()
115
- l.error :build_with_other_item if resource.attributes["type"].to_s() == "other" and items.include?(object_id)
116
- end
117
- end
118
- end
95
+
96
+ l.error :build_with_other_item if model_doc.css('build/item').map { |x| x.attributes["objectid"].value }.map{ |id| model_doc.search(".//xmlns:object[@id=$id][@type=$type]", nil, { :id => id, :type => 'other' } ) }.flatten.any?
97
+
119
98
  end
120
99
 
121
100
  l.context "checking metadata" do |l|
@@ -134,8 +113,8 @@ class Model3mf
134
113
  end
135
114
  end
136
115
  end
137
-
138
- MeshAnalyzer.validate(model_doc)
116
+ includes_material = model_doc.namespaces.values.include?(MATERIAL_EXTENSION)
117
+ MeshAnalyzer.validate(model_doc, includes_material)
139
118
  end
140
119
  model_doc
141
120
  end
@@ -5,8 +5,22 @@ class SchemaFiles
5
5
  SchemaTemplate = File.join(File.dirname(__FILE__), "3MFcoreSpec_1.1.xsd.template")
6
6
  SchemaLocation = File.join(File.dirname(__FILE__), "xml.xsd")
7
7
 
8
- def self.render(template)
9
- ERB.new(template).result( binding )
8
+ class << self
9
+
10
+ def open(file)
11
+ @@template ||= File.open(file, "r") do |file|
12
+ file.read
13
+ end
14
+
15
+ yield(SchemaFiles.render)
16
+
17
+ end
18
+
19
+ def render
20
+ @@xsd_content ||= ERB.new(@@template).result( binding )
21
+ end
22
+
10
23
  end
11
24
 
25
+
12
26
  end
@@ -11,6 +11,11 @@ class Thumbnail3mf
11
11
 
12
12
  img_colorspace = MiniMagick::Image.read(relationship_file.get_input_stream).colorspace
13
13
  l.fatal_error :invalid_thumbnail_colorspace if img_colorspace.include? "CMYK"
14
+
15
+ if relationship_file.respond_to?(:name)
16
+ decl_type = doc.types.get_type(relationship_file.name)
17
+ l.error :thumbnail_image_type_mismatch if decl_type != img_type.to_s
18
+ end
14
19
  end
15
20
  end
16
21
  end
@@ -1,3 +1,3 @@
1
1
  module Ruby3mf
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -10,13 +10,6 @@ class XmlVal
10
10
  doc
11
11
  end
12
12
 
13
- def self.open_schema_file(file)
14
- File.open(file, "r") do |file|
15
- template = file.read
16
- yield(SchemaFiles.render(template))
17
- end
18
- end
19
-
20
13
  def self.validate(file, document, schema_filename = nil)
21
14
  Log3mf.context "validations" do |l|
22
15
  l.error :has_xml_space_attribute if space_attribute_exists?(document)
@@ -27,7 +20,7 @@ class XmlVal
27
20
 
28
21
  if schema_filename
29
22
  Log3mf.context "validating core schema" do |l|
30
- open_schema_file(schema_filename) do |content|
23
+ SchemaFiles.open(schema_filename) do |content|
31
24
  xsd = Nokogiri::XML::Schema(content)
32
25
  puts "the schema is NIL!" if xsd.nil?
33
26
  core_schema_errors = xsd.validate(document)
@@ -0,0 +1,237 @@
1
+
2
+
3
+ Positive
4
+ ...............
5
+ ../3mf-test-suite/Positive/PC_304_01.3mf
6
+ {:context=>"zip/relationship elements//Metadata/core.prop", :severity=>:error, :message=>"Invalid relationship type 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties' specified in .rels relationship file. Parts in the 3D payload MUST use one of the appropriate relationship types to establish that relationship between two parts in the payload."}
7
+ .
8
+ ../3mf-test-suite/Positive/PC_305_01.3mf
9
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/verifying 3D payload required resources/verifying 3D resource types", :severity=>:error, :message=>"Resource in model has invalid contenttype image/png"}
10
+ {:context=>"zip/relationship elements//3D/Textures/texture.png/Texture3mf", :severity=>:fatal_error, :message=>"Texture file must be valid image file"}
11
+ .............
12
+ ../3mf-test-suite/Positive/PC_312_01.3mf
13
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/verifying resources", :severity=>:error, :message=>"resources must be unique within the model"}
14
+ .................................................................................
15
+ ../3mf-test-suite/Positive/PM_909_02.3mf
16
+ {:context=>"zip/relationship elements//2D/337.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
17
+ .
18
+ ../3mf-test-suite/Positive/PM_909_03.3mf
19
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/checking metadata", :severity=>:error, :message=>"Metadata without a namespace name must only contain allowed name values"}
20
+ .
21
+ ../3mf-test-suite/Positive/PM_909_04.3mf
22
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
23
+ ..
24
+ ../3mf-test-suite/Positive/PO_101_01.3mf
25
+ {:context=>"zip/content types", :severity=>:error, :message=>"Required 3D model payload not found with provided Content Type model extension: .ModeL"}
26
+ .
27
+ ../3mf-test-suite/Positive/PO_101_02.3mf
28
+ {:context=>"zip/relationship elements//2D/ffffa2c3-ba74-4bea-a4d0-167a4211134d/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
29
+ .
30
+ ../3mf-test-suite/Positive/PO_101_03.3mf
31
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
32
+ .
33
+ ../3mf-test-suite/Positive/PO_102_01.3mf
34
+ {:context=>"zip/content types/parse", :severity=>:error, :message=>"[Content_Types].xml is missing required ContentType \"application/vnd.ms-package.3dmanufacturing-3dmodel+xml\""}
35
+ {:context=>"zip/content types", :severity=>:error, :message=>"Required 3D model payload not found with provided Content Type model extension: ."}
36
+ {:context=>"zip/relationship elements//2D/ffffa2c3-ba74-4bea-a4d0-167a4211134d.moodel/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
37
+ .
38
+ ../3mf-test-suite/Positive/PO_102_02.3mf
39
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
40
+ ..
41
+ ../3mf-test-suite/Positive/PO_103_01.3mf
42
+ {:context=>"zip/relationship elements//2D/ffffa2c3-ba74-4bea-a4d0-167a4211134d.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
43
+ .
44
+ ../3mf-test-suite/Positive/PO_104_01.3mf
45
+ {:context=>"zip/relationship elements//2D/1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
46
+ .
47
+ ../3mf-test-suite/Positive/PO_104_02.3mf
48
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
49
+ .
50
+ ../3mf-test-suite/Positive/PO_104_03.3mf
51
+ {:context=>"zip/part names /2D/fdfd166f-4f4c-4259-bb96-01e4fb03\xC3\x86381.model", :severity=>:fatal_error, :message=>"This NEVER Happens! mdw 12Jan2017"}
52
+ .
53
+ ../3mf-test-suite/Positive/PO_105_02.3mf
54
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
55
+ .
56
+ ../3mf-test-suite/Positive/PO_105_03.3mf
57
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
58
+ ..
59
+ ../3mf-test-suite/Positive/PO_105_05.3mf
60
+ {:context=>"zip/relationship elements//2D/9e1cbf53-9bb1-48fb-aced-acbb9cbbe79f.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
61
+ ..
62
+ ../3mf-test-suite/Positive/PO_105_07.3mf
63
+ {:context=>"zip/relationship elements//2D/9e1cbf53-9bb1-48fb-aced-acbb9cbbe79f.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
64
+ .
65
+ ../3mf-test-suite/Positive/PO_105_09.3mf
66
+ {:context=>"zip/relationship elements//2D/9e1cbf53-9bb1-48fb-aced-acbb9cbbe79f.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
67
+ ...
68
+ ../3mf-test-suite/Positive/PO_106_01.3mf
69
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
70
+ ..
71
+ ../3mf-test-suite/Positive/PO_107_01.3mf
72
+ {:context=>"zip/relationship elements//2D/ffffa2c3-ba74-4bea-a4d0-167a4211134d.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
73
+ .
74
+ ../3mf-test-suite/Positive/PO_107_02.3mf
75
+ {:context=>"zip/relationship elements//2D/ffffa2c3-ba74-4bea-a4d0-167a4211134d.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
76
+ .
77
+ ../3mf-test-suite/Positive/PO_108_01.3mf
78
+ {:context=>"zip/relationship elements//2D/ffffa2c3-ba74-4bea-a4d0-167a4211134d.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
79
+ .
80
+ ../3mf-test-suite/Positive/PP_701_01.3mf
81
+ {:context=>"zip/relationship elements//2D/7b7c4f2f-3b64-49b9-a098-a978332e8d1a.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
82
+ .
83
+ ../3mf-test-suite/Positive/PP_701_02.3mf
84
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
85
+ .
86
+ ../3mf-test-suite/Positive/PP_701_04.3mf
87
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
88
+ .
89
+ ../3mf-test-suite/Positive/PP_701_05.3mf
90
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
91
+ ..
92
+ ../3mf-test-suite/Positive/PP_701_07.3mf
93
+ {:context=>"zip/relationship elements//2D/d9d8d141-23ff-4cdc-8da1-66b33dd69757.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
94
+ .
95
+ ../3mf-test-suite/Positive/PP_701_08.3mf
96
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
97
+ .
98
+ ../3mf-test-suite/Positive/PP_701_09.3mf
99
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
100
+ .
101
+ ../3mf-test-suite/Positive/PP_701_11.3mf
102
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
103
+ .
104
+ ../3mf-test-suite/Positive/PP_701_12.3mf
105
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/verifying 3D payload required resources/verifying StartPart relationship points to the root 3D Model", :severity=>:fatal_error, :message=>"Invalid StartPart target '/3D/3dmodel.model'. The 3MF Document StartPart relationship MUST point to the 3D Model part that identifies the root of the 3D payload."}
106
+ .
107
+ ../3mf-test-suite/Positive/PP_701_13.3mf
108
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
109
+ .
110
+ ../3mf-test-suite/Positive/PP_701_14.3mf
111
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
112
+ ...
113
+ ../3mf-test-suite/Positive/PP_701_17.3mf
114
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
115
+ .
116
+ ../3mf-test-suite/Positive/PP_701_18.3mf
117
+ {:context=>"zip/relationship elements//2D/0082f270-d84a-4646-8510-05bc3490bd6f.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
118
+ .
119
+ ../3mf-test-suite/Positive/PP_701_19.3mf
120
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
121
+ .
122
+ ../3mf-test-suite/Positive/PP_701_20.3mf
123
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
124
+ .
125
+ ../3mf-test-suite/Positive/PP_701_21.3mf
126
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
127
+ ..
128
+ ../3mf-test-suite/Positive/PP_701_23.3mf
129
+ {:context=>"zip/relationship elements//2D/dbc5f09a-6bf4-4e9b-9b70-0e418111e81f.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
130
+ ...
131
+ ../3mf-test-suite/Positive/PP_701_26.3mf
132
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
133
+ .
134
+ ../3mf-test-suite/Positive/PP_701_27.3mf
135
+ {:context=>"zip/relationship elements//2D/topref.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
136
+ .
137
+ ../3mf-test-suite/Positive/PP_701_30.3mf
138
+ {:context=>"zip/relationship elements//2D/0c853b1f-388f-4bd0-a23e-45426e2aa769.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
139
+ ..
140
+ ../3mf-test-suite/Positive/PP_701_32.3mf
141
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/verifying 3D payload required resources/verifying StartPart relationship points to the root 3D Model", :severity=>:fatal_error, :message=>"Invalid StartPart target '/3D/3dmodel.model'. The 3MF Document StartPart relationship MUST point to the 3D Model part that identifies the root of the 3D payload."}
142
+ .
143
+ ../3mf-test-suite/Positive/PP_703_01.3mf
144
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
145
+ .
146
+ ../3mf-test-suite/Positive/PP_704_01.3mf
147
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
148
+ ......
149
+ ../3mf-test-suite/Positive/PS_502_03.3mf
150
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
151
+ .
152
+ ../3mf-test-suite/Positive/PS_502_04.3mf
153
+ {:context=>"zip/relationship elements//2D/ffffa2c3-ba74-4bea-a4d0-167a4211134d.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
154
+ .
155
+ ../3mf-test-suite/Positive/PS_502_05.3mf
156
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
157
+ .
158
+ ../3mf-test-suite/Positive/PS_503_01.3mf
159
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
160
+ .
161
+ ../3mf-test-suite/Positive/PS_503_02.3mf
162
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
163
+ ...
164
+ ../3mf-test-suite/Positive/PS_505_01.3mf
165
+ {:context=>"zip/relationship elements//2D/917d27a5-e210-4bd8-a430-0dacc3be6d95.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
166
+ .
167
+ ../3mf-test-suite/Positive/PS_505_02.3mf
168
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
169
+ ..
170
+ ../3mf-test-suite/Positive/PS_506_01.3mf
171
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/verifying resources", :severity=>:error, :message=>"resources must be unique within the model"}
172
+ {:context=>"zip/relationship elements//2D/ad8bd6de-d9b5-446a-8fcd-e75a3bc63c8b.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
173
+ .....
174
+ ../3mf-test-suite/Positive/PS_509_02.3mf
175
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
176
+ ..
177
+ ../3mf-test-suite/Positive/PS_509_04.3mf
178
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
179
+ ..
180
+ ../3mf-test-suite/Positive/PS_511_01.3mf
181
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
182
+ .
183
+ ../3mf-test-suite/Positive/PS_511_02.3mf
184
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
185
+ .
186
+ ../3mf-test-suite/Positive/PS_511_03.3mf
187
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
188
+ .
189
+ ../3mf-test-suite/Positive/PS_511_04.3mf
190
+ {:context=>"zip/relationship elements//2D/ffffa2c3-ba74-4bea-a4d0-167a4211134d.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
191
+ ...
192
+ ../3mf-test-suite/Positive/PS_512_01.3mf
193
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
194
+ ..
195
+ ../3mf-test-suite/Positive/PS_513_02.3mf
196
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
197
+ .
198
+ ../3mf-test-suite/Positive/PS_513_03.3mf
199
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
200
+ .
201
+ ../3mf-test-suite/Positive/PS_514_01.3mf
202
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
203
+ ..
204
+ ../3mf-test-suite/Positive/PS_515_01.3mf
205
+ {:context=>"zip/relationship elements//2D/9e1cbf53-9bb1-48fb-aced-acbb9cbbe79f.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
206
+ .
207
+ ../3mf-test-suite/Positive/PS_516_01.3mf
208
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/verifying 3D payload required resources/verifying StartPart relationship points to the root 3D Model", :severity=>:fatal_error, :message=>"Invalid StartPart target '/3D/3dmodel.model'. The 3MF Document StartPart relationship MUST point to the 3D Model part that identifies the root of the 3D payload."}
209
+ .
210
+ ../3mf-test-suite/Positive/PS_516_02.3mf
211
+ {:context=>"zip/relationship elements//3D/3dmodel.model/parsing model/validations/validating core schema", :severity=>:fatal_error, :message=>"Model file invalid XML. Exception attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration."}
212
+
213
+
214
+ Negative
215
+ ...............
216
+ ../3mf-test-suite/Negative/NC_405_04.3mf - No Errors Found!
217
+ .....
218
+ ../3mf-test-suite/Negative/NC_407_02.3mf - No Errors Found!
219
+ .......
220
+ ../3mf-test-suite/Negative/NC_411_01.3mf - No Errors Found!
221
+ .....
222
+ ../3mf-test-suite/Negative/NC_413_01.3mf - No Errors Found!
223
+ .................
224
+ ../3mf-test-suite/Negative/NO_202_01.3mf - No Errors Found!
225
+ ...
226
+ ../3mf-test-suite/Negative/NO_205_01.3mf - No Errors Found!
227
+ .
228
+ ../3mf-test-suite/Negative/NO_205_02.3mf - No Errors Found!
229
+ ....
230
+ ../3mf-test-suite/Negative/NP_801_01.3mf - No Errors Found!
231
+ ...
232
+ ../3mf-test-suite/Negative/NP_801_04.3mf - No Errors Found!
233
+ ...
234
+ ../3mf-test-suite/Negative/NP_801_07.3mf - No Errors Found!
235
+ .
236
+ ../3mf-test-suite/Negative/NP_801_08.3mf - No Errors Found!
237
+ ....................................
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby3mf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Whitmarsh, Jeff Porter, and William Hertling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-21 00:00:00.000000000 Z
11
+ date: 2017-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -139,6 +139,7 @@ files:
139
139
  - CODE_OF_CONDUCT.md
140
140
  - Gemfile
141
141
  - LICENSE.txt
142
+ - PO_102_03.3mf
142
143
  - README.md
143
144
  - Rakefile
144
145
  - bin/batch.rb
@@ -146,8 +147,13 @@ files:
146
147
  - bin/console
147
148
  - bin/folder_test.sh
148
149
  - bin/setup
149
- - bin/suite.rb
150
150
  - bin/suite_test.sh
151
+ - foo/2D/ffffa2c3-ba74-4bea-a4d0-167a4211134d.model
152
+ - foo/3D/3dmodel.model
153
+ - foo/3D/_rels/3dmodel.model.rels
154
+ - foo/Thumbnails/ffffa6c3-ba74-4bea-a4d0-167a4211134d.model
155
+ - foo/[Content_Types].xml
156
+ - foo/_rels/.rels
151
157
  - lib/ruby3mf.rb
152
158
  - lib/ruby3mf/3MFcoreSpec_1.1.xsd.template
153
159
  - lib/ruby3mf/content_types.rb
@@ -166,6 +172,7 @@ files:
166
172
  - lib/ruby3mf/xml.xsd
167
173
  - lib/ruby3mf/xml_val.rb
168
174
  - ruby3mf.gemspec
175
+ - suite.011917.out
169
176
  homepage: https://github.com/IPGPTP/ruby3mf
170
177
  licenses:
171
178
  - MIT
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative '../lib/ruby3mf'
4
-
5
- # usage
6
- # bin/suite.rb {path to 3mf-test-suite} optional
7
- # assumes . is ~/src/ruby3mf and that ~/src/3mf-test-suite is path to suite repo files
8
-
9
- $stdout.sync = true
10
-
11
- good_files = Dir["#{ARGV[0] || '../3mf-test-suite'}/Positive/*.3mf"]
12
- bad_files = Dir["#{ARGV[0] || '../3mf-test-suite'}/Negative/*.3mf"]
13
-
14
- false_negatives = {}
15
- true_negatives={}
16
- false_positives = []
17
-
18
- def val3mf(f)
19
- Log3mf.reset_log
20
- Document.read(f)
21
- Log3mf.entries(:fatal_error, :error)
22
- end
23
-
24
- puts "\n\nPositive"
25
- good_files.each do |file|
26
- print "." # "Validating file: #{file}"
27
- errors=val3mf(file)
28
-
29
- if errors.size > 0
30
- false_negatives[file]=errors
31
- puts "\n#{file}"
32
- errors.each do |ent|
33
- h = {context: ent[0], severity: ent[1], message: ent[2]}
34
- puts " #{h}"
35
- end
36
- end
37
-
38
- end
39
-
40
- puts "\n\nNegative"
41
- bad_files.each do |file|
42
- print "." #puts "Validating file #{file}"
43
- errors=val3mf(file)
44
- if errors.size > 0
45
- true_negatives[file] = errors
46
- else
47
- false_positives << file
48
- puts "\n#{file} - No Errors Found!"
49
- end
50
- end