xsd_model 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +32 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dependencies.xsd +4 -0
- data/dependencies2.xsd +4 -0
- data/lib/xsd_model/document_attributes.rb +16 -0
- data/lib/xsd_model/elements/all.rb +7 -0
- data/lib/xsd_model/elements/annotation.rb +7 -0
- data/lib/xsd_model/elements/any.rb +7 -0
- data/lib/xsd_model/elements/any_attribute.rb +7 -0
- data/lib/xsd_model/elements/appinfo.rb +7 -0
- data/lib/xsd_model/elements/attribute.rb +7 -0
- data/lib/xsd_model/elements/attribute_group.rb +7 -0
- data/lib/xsd_model/elements/attribute_methods.rb +25 -0
- data/lib/xsd_model/elements/base_element.rb +74 -0
- data/lib/xsd_model/elements/choice.rb +7 -0
- data/lib/xsd_model/elements/collection.rb +7 -0
- data/lib/xsd_model/elements/comment.rb +7 -0
- data/lib/xsd_model/elements/complex_content.rb +7 -0
- data/lib/xsd_model/elements/complex_type.rb +11 -0
- data/lib/xsd_model/elements/content.rb +7 -0
- data/lib/xsd_model/elements/doctype.rb +7 -0
- data/lib/xsd_model/elements/document.rb +11 -0
- data/lib/xsd_model/elements/documentation.rb +7 -0
- data/lib/xsd_model/elements/element.rb +24 -0
- data/lib/xsd_model/elements/enumeration.rb +7 -0
- data/lib/xsd_model/elements/extension.rb +19 -0
- data/lib/xsd_model/elements/fraction_digits.rb +7 -0
- data/lib/xsd_model/elements/group.rb +7 -0
- data/lib/xsd_model/elements/import.rb +17 -0
- data/lib/xsd_model/elements/include.rb +17 -0
- data/lib/xsd_model/elements/length.rb +7 -0
- data/lib/xsd_model/elements/logical.rb +7 -0
- data/lib/xsd_model/elements/max_inclusive.rb +7 -0
- data/lib/xsd_model/elements/max_length.rb +7 -0
- data/lib/xsd_model/elements/min_exclusive.rb +7 -0
- data/lib/xsd_model/elements/min_inclusive.rb +7 -0
- data/lib/xsd_model/elements/min_length.rb +7 -0
- data/lib/xsd_model/elements/pattern.rb +7 -0
- data/lib/xsd_model/elements/requires.rb +42 -0
- data/lib/xsd_model/elements/restriction.rb +7 -0
- data/lib/xsd_model/elements/schema.rb +48 -0
- data/lib/xsd_model/elements/schema_info.rb +7 -0
- data/lib/xsd_model/elements/sequence.rb +7 -0
- data/lib/xsd_model/elements/simple_content.rb +7 -0
- data/lib/xsd_model/elements/simple_type.rb +7 -0
- data/lib/xsd_model/elements/text.rb +7 -0
- data/lib/xsd_model/elements/total_digits.rb +7 -0
- data/lib/xsd_model/elements/union.rb +7 -0
- data/lib/xsd_model/elements/white_space.rb +7 -0
- data/lib/xsd_model/parser.rb +44 -0
- data/lib/xsd_model/xsdize.rb +23 -0
- data/lib/xsd_model.rb +29 -0
- data/subschema.xsd +5 -0
- data/xsd_model.gemspec +28 -0
- metadata +190 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ab5642b2787d8596e68bbc9ee7389950233d088d
|
4
|
+
data.tar.gz: 72955be31bdfc6d0ee2e5eab0ca8592fc09e0fd3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 111b7932467ce8a36f7bfc8a1a37c69a582603c3918c56b5c9b0721e8655fe2892acc6d7f66b867245da6b31a6563586508f3a39fde5863da98d132492866592
|
7
|
+
data.tar.gz: e092dceb6d234cac38f0581c675102821ffabffcc5f71c281fae216ba85361877f773d1e2a51b90801447270afd476edc1e66785b0a665931679961df74024e7
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Premysl Donat
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# XsdModel [![Build Status](https://travis-ci.org/Masa331/xsd_model.svg?branch=master)](https://travis-ci.org/Masa331/xsd_model)
|
2
|
+
|
3
|
+
*Note that this can be unstable until 1.0.0*
|
4
|
+
|
5
|
+
Takes a XSD string and parses it into a tree structure of nodes. A lot similar to Nokogiri but with few more useful methods.
|
6
|
+
|
7
|
+
Content:
|
8
|
+
1. [About](#about)
|
9
|
+
2. [Api](#api)
|
10
|
+
5. [License](#license)
|
11
|
+
|
12
|
+
## About
|
13
|
+
|
14
|
+
This gem provides a parser which takes XSD in a string and outputs tree structure of objects much like Nokogiri(which is internally used for parsing) does with XML. Each returned object represents one specific XSD core element and implements specific API to simplify the work with XSD. As it's written under the top heading, the API can be unstable until 1.0.0 and might miss some core XSD elements, attribute accessors, etc.
|
15
|
+
|
16
|
+
## Api
|
17
|
+
|
18
|
+
* basic parsing
|
19
|
+
* ignore option
|
20
|
+
* collect only option
|
21
|
+
* basic api - children, attributes, namespaces
|
22
|
+
* navigation shorthands(`#elements`)
|
23
|
+
* imports
|
24
|
+
* includes
|
25
|
+
* `Schema` api
|
26
|
+
* comparison
|
27
|
+
|
28
|
+
...
|
29
|
+
|
30
|
+
## License
|
31
|
+
|
32
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "xsd_model"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/dependencies.xsd
ADDED
data/dependencies2.xsd
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module XsdModel
|
2
|
+
module DocumentAttributes
|
3
|
+
FakeAttr = Struct.new(:name, :value)
|
4
|
+
|
5
|
+
refine Nokogiri::XML::Document do
|
6
|
+
def attributes
|
7
|
+
attrs = {}
|
8
|
+
|
9
|
+
attrs['encoding'] = FakeAttr.new('encoding', encoding) if encoding
|
10
|
+
attrs['version'] = FakeAttr.new('version', version) if version
|
11
|
+
|
12
|
+
attrs
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'xsd_model/xsdize'
|
2
|
+
|
3
|
+
module XsdModel
|
4
|
+
module Elements
|
5
|
+
module AttributeMethods
|
6
|
+
using Xsdize
|
7
|
+
|
8
|
+
def attribute_method(*attr_names)
|
9
|
+
attr_names.each do |attr_name|
|
10
|
+
define_method attr_name.underscore do
|
11
|
+
attributes[attr_name.to_s]
|
12
|
+
end
|
13
|
+
|
14
|
+
define_method "has_#{attr_name.underscore}?" do
|
15
|
+
!attributes[attr_name.to_s].nil?
|
16
|
+
end
|
17
|
+
|
18
|
+
define_method "no_#{attr_name.underscore}?" do
|
19
|
+
attributes[attr_name.to_s].nil?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'xsd_model/elements/attribute_methods'
|
2
|
+
require 'xsd_model/xsdize'
|
3
|
+
|
4
|
+
module XsdModel
|
5
|
+
module Elements
|
6
|
+
module BaseElement
|
7
|
+
extend AttributeMethods
|
8
|
+
using Xsdize
|
9
|
+
|
10
|
+
XSD_URI = 'http://www.w3.org/2001/XMLSchema'
|
11
|
+
|
12
|
+
attr_accessor :children, :attributes, :namespaces
|
13
|
+
attribute_method :name, :type, :ref
|
14
|
+
|
15
|
+
def initialize(*args)
|
16
|
+
hashes, rest = args.partition { |arg| arg.is_a? Hash }
|
17
|
+
|
18
|
+
@children = rest.flatten
|
19
|
+
@attributes = hashes[0] || {}
|
20
|
+
@namespaces = hashes[1] || {}
|
21
|
+
end
|
22
|
+
|
23
|
+
def xsd_prefix
|
24
|
+
namespaces.invert[XSD_URI].gsub('xmlns:', '')
|
25
|
+
end
|
26
|
+
|
27
|
+
def element_name
|
28
|
+
self.class.name.demodulize.underscore
|
29
|
+
end
|
30
|
+
|
31
|
+
def has_custom_type?
|
32
|
+
has_type? && !type.start_with?("#{xsd_prefix}:")
|
33
|
+
end
|
34
|
+
|
35
|
+
def basic_xsd_type?
|
36
|
+
has_type? && type.start_with?("#{xsd_prefix}:")
|
37
|
+
end
|
38
|
+
|
39
|
+
def empty?
|
40
|
+
children.empty?
|
41
|
+
end
|
42
|
+
|
43
|
+
def ==(other)
|
44
|
+
(attributes == other.attributes) &&
|
45
|
+
(children == other.children)
|
46
|
+
end
|
47
|
+
|
48
|
+
def reverse_traverse(&block)
|
49
|
+
children_result = children.map do |child|
|
50
|
+
child.reverse_traverse(&block)
|
51
|
+
end
|
52
|
+
|
53
|
+
yield self, children_result
|
54
|
+
end
|
55
|
+
|
56
|
+
#TODO: add similar #respond_to? method
|
57
|
+
def method_missing(name, *args)
|
58
|
+
super if name.to_s.end_with? '?'
|
59
|
+
|
60
|
+
if XsdModel::Elements.const_defined? name.camelize # TotalDigits.. :]
|
61
|
+
const = XsdModel::Elements.const_get name.camelize
|
62
|
+
|
63
|
+
children.select { |child| child.is_a? const }
|
64
|
+
elsif XsdModel::Elements.const_defined? name.camelize.singularize
|
65
|
+
const = XsdModel::Elements.const_get name.camelize.singularize
|
66
|
+
|
67
|
+
children.select { |child| child.is_a? const }
|
68
|
+
else
|
69
|
+
super
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module XsdModel
|
2
|
+
module Elements
|
3
|
+
class Element
|
4
|
+
include BaseElement
|
5
|
+
|
6
|
+
def max_occurs
|
7
|
+
value = attributes['maxOccurs']
|
8
|
+
|
9
|
+
case value
|
10
|
+
when 'unbounded'
|
11
|
+
then Float::INFINITY
|
12
|
+
when String
|
13
|
+
then value.to_i
|
14
|
+
when nil
|
15
|
+
then 1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def multiple?
|
20
|
+
max_occurs > 1
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module XsdModel
|
2
|
+
module Elements
|
3
|
+
class Extension
|
4
|
+
include BaseElement
|
5
|
+
#TODO: why isn't this picked up from BaseElement where it's also extended?
|
6
|
+
extend AttributeMethods
|
7
|
+
|
8
|
+
attribute_method :base
|
9
|
+
|
10
|
+
def basic_xsd_extension?
|
11
|
+
base.start_with?("#{xsd_prefix}:")
|
12
|
+
end
|
13
|
+
|
14
|
+
def custom_extension?
|
15
|
+
!basic_xsd_extension?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module XsdModel
|
2
|
+
module Elements
|
3
|
+
class Import
|
4
|
+
include BaseElement
|
5
|
+
#TODO: why isn't this picked up from BaseElement where it's also extended?
|
6
|
+
extend AttributeMethods
|
7
|
+
|
8
|
+
attribute_method :namespace, 'schemaLocation'
|
9
|
+
|
10
|
+
def load(options = {})
|
11
|
+
xml_string = File.read(schema_location)
|
12
|
+
|
13
|
+
XsdModel.parse(xml_string, options).schema
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module XsdModel
|
2
|
+
module Elements
|
3
|
+
class Include
|
4
|
+
include BaseElement
|
5
|
+
#TODO: why isn't this picked up from BaseElement where it's also extended?
|
6
|
+
extend AttributeMethods
|
7
|
+
|
8
|
+
attribute_method 'schemaLocation'
|
9
|
+
|
10
|
+
def load(options = {})
|
11
|
+
xml_string = File.read(schema_location)
|
12
|
+
|
13
|
+
XsdModel.parse(xml_string, options).schema
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'xsd_model/elements/base_element'
|
2
|
+
require 'xsd_model/elements/import'
|
3
|
+
require 'xsd_model/elements/document'
|
4
|
+
require 'xsd_model/elements/max_length'
|
5
|
+
require 'xsd_model/elements/choice'
|
6
|
+
require 'xsd_model/elements/logical'
|
7
|
+
require 'xsd_model/elements/min_inclusive'
|
8
|
+
require 'xsd_model/elements/min_length'
|
9
|
+
require 'xsd_model/elements/content'
|
10
|
+
require 'xsd_model/elements/comment'
|
11
|
+
require 'xsd_model/elements/any'
|
12
|
+
require 'xsd_model/elements/min_exclusive'
|
13
|
+
require 'xsd_model/elements/simple_content'
|
14
|
+
require 'xsd_model/elements/white_space'
|
15
|
+
require 'xsd_model/elements/extension'
|
16
|
+
require 'xsd_model/elements/sequence'
|
17
|
+
require 'xsd_model/elements/complex_content'
|
18
|
+
require 'xsd_model/elements/documentation'
|
19
|
+
require 'xsd_model/elements/doctype'
|
20
|
+
require 'xsd_model/elements/any_attribute'
|
21
|
+
require 'xsd_model/elements/max_inclusive'
|
22
|
+
require 'xsd_model/elements/attribute'
|
23
|
+
require 'xsd_model/elements/complex_type'
|
24
|
+
require 'xsd_model/elements/include'
|
25
|
+
require 'xsd_model/elements/schema_info'
|
26
|
+
require 'xsd_model/elements/pattern'
|
27
|
+
require 'xsd_model/elements/length'
|
28
|
+
require 'xsd_model/elements/annotation'
|
29
|
+
require 'xsd_model/elements/schema'
|
30
|
+
require 'xsd_model/elements/element'
|
31
|
+
require 'xsd_model/elements/fraction_digits'
|
32
|
+
require 'xsd_model/elements/union'
|
33
|
+
require 'xsd_model/elements/text'
|
34
|
+
require 'xsd_model/elements/total_digits'
|
35
|
+
require 'xsd_model/elements/all'
|
36
|
+
require 'xsd_model/elements/appinfo'
|
37
|
+
require 'xsd_model/elements/enumeration'
|
38
|
+
require 'xsd_model/elements/group'
|
39
|
+
require 'xsd_model/elements/collection'
|
40
|
+
require 'xsd_model/elements/attribute_group'
|
41
|
+
require 'xsd_model/elements/restriction'
|
42
|
+
require 'xsd_model/elements/simple_type'
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module XsdModel
|
2
|
+
module Elements
|
3
|
+
class Schema
|
4
|
+
include BaseElement
|
5
|
+
extend AttributeMethods
|
6
|
+
|
7
|
+
attribute_method 'targetNamespace'
|
8
|
+
|
9
|
+
def collect_imported_schemas(options = {})
|
10
|
+
_collect_imported_schemas(self, options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def _collect_imported_schemas(original_schema, options, already_collected = [])
|
14
|
+
imports = original_schema.imports
|
15
|
+
|
16
|
+
imports.each do |import|
|
17
|
+
unless already_collected.map { |d| d.target_namespace }.include? import.namespace
|
18
|
+
new_schema = import.load(options)
|
19
|
+
already_collected << new_schema
|
20
|
+
_collect_imported_schemas(new_schema, options, already_collected)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
already_collected
|
25
|
+
end
|
26
|
+
|
27
|
+
def collect_included_schemas(options = {})
|
28
|
+
_collect_included_schemas(self, options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def _collect_included_schemas(original_schema, options, collected_schemas = [], collected_paths = [])
|
32
|
+
includes = original_schema.includes
|
33
|
+
|
34
|
+
includes.each do |incl|
|
35
|
+
unless collected_paths.include? incl.schema_location
|
36
|
+
new_schema = incl.load(options)
|
37
|
+
collected_schemas << new_schema
|
38
|
+
collected_paths << incl.schema_location
|
39
|
+
|
40
|
+
_collect_included_schemas(new_schema, options, collected_schemas, collected_paths)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
collected_schemas
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'active_support/inflector'
|
3
|
+
require 'xsd_model/document_attributes'
|
4
|
+
require 'xsd_model/elements/requires'
|
5
|
+
|
6
|
+
module XsdModel
|
7
|
+
class Parser
|
8
|
+
using DocumentAttributes
|
9
|
+
|
10
|
+
def self.call(xml_string, options = {})
|
11
|
+
new(xml_string, options).call
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(xml_string, options)
|
15
|
+
@xml = Nokogiri(xml_string)
|
16
|
+
@options = options
|
17
|
+
end
|
18
|
+
|
19
|
+
def call
|
20
|
+
parse_node(@xml)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def parse_node(node)
|
26
|
+
klass = XsdModel::Elements.const_get node.name.camelize
|
27
|
+
|
28
|
+
children = collect_children(node).map { |child| parse_node(child) }
|
29
|
+
attributes = node.attributes.transform_values(&:value)
|
30
|
+
namespaces = node.namespaces
|
31
|
+
|
32
|
+
klass.new(children, attributes, namespaces)
|
33
|
+
end
|
34
|
+
|
35
|
+
def collect_children(node)
|
36
|
+
skippable, collectible = node.children.partition do |child|
|
37
|
+
(@options[:collect_only] && !@options[:collect_only].call(child)) ||
|
38
|
+
(@options[:ignore] && @options[:ignore].call(child))
|
39
|
+
end
|
40
|
+
|
41
|
+
collectible + skippable.flat_map { |child| collect_children(child) }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module XsdModel
|
2
|
+
module Xsdize
|
3
|
+
refine String do
|
4
|
+
def xsdize
|
5
|
+
camelize(:lower)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
refine Symbol do
|
10
|
+
def xsdize
|
11
|
+
to_s.camelize(:lower)
|
12
|
+
end
|
13
|
+
|
14
|
+
def camelize
|
15
|
+
to_s.camelize
|
16
|
+
end
|
17
|
+
|
18
|
+
def underscore
|
19
|
+
to_s.underscore
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/xsd_model.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'xsd_model/parser'
|
2
|
+
require 'xsd_model/xsdize'
|
3
|
+
|
4
|
+
module XsdModel
|
5
|
+
class UnknownOptionType < StandardError; end
|
6
|
+
|
7
|
+
using Xsdize
|
8
|
+
|
9
|
+
def self.parse(xml_string, options = {})
|
10
|
+
Parser.call(xml_string, normalize_options(options))
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def self.normalize_options(options)
|
16
|
+
options.transform_values do |value|
|
17
|
+
case value
|
18
|
+
when Proc
|
19
|
+
then value
|
20
|
+
when String, Symbol
|
21
|
+
then -> (child) { [value.xsdize].include? child.name }
|
22
|
+
when Array
|
23
|
+
then -> (child) { value.map(&:xsdize).include? child.name }
|
24
|
+
else
|
25
|
+
fail UnknownOptionType, 'Option given has to be either String, Symbol, Array, or Proc.'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/subschema.xsd
ADDED
data/xsd_model.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'xsd_model'
|
7
|
+
spec.version = '0.5.0'
|
8
|
+
spec.authors = ['Premysl Donat']
|
9
|
+
spec.email = ['pdonat@seznam.cz']
|
10
|
+
|
11
|
+
spec.summary = 'XSD parser'
|
12
|
+
spec.description = 'Takes a XSD string and parses it into a tree structure of nodes. A lot similar to Nokogiri but with few more useful methods.'
|
13
|
+
spec.homepage = 'https://github.com/Masa331/xsd_model'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'nokogiri'
|
22
|
+
spec.add_dependency 'activesupport'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'pry'
|
25
|
+
spec.add_development_dependency 'bundler'
|
26
|
+
spec.add_development_dependency 'rake'
|
27
|
+
spec.add_development_dependency 'rspec'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xsd_model
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Premysl Donat
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Takes a XSD string and parses it into a tree structure of nodes. A lot
|
98
|
+
similar to Nokogiri but with few more useful methods.
|
99
|
+
email:
|
100
|
+
- pdonat@seznam.cz
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- dependencies.xsd
|
115
|
+
- dependencies2.xsd
|
116
|
+
- lib/xsd_model.rb
|
117
|
+
- lib/xsd_model/document_attributes.rb
|
118
|
+
- lib/xsd_model/elements/all.rb
|
119
|
+
- lib/xsd_model/elements/annotation.rb
|
120
|
+
- lib/xsd_model/elements/any.rb
|
121
|
+
- lib/xsd_model/elements/any_attribute.rb
|
122
|
+
- lib/xsd_model/elements/appinfo.rb
|
123
|
+
- lib/xsd_model/elements/attribute.rb
|
124
|
+
- lib/xsd_model/elements/attribute_group.rb
|
125
|
+
- lib/xsd_model/elements/attribute_methods.rb
|
126
|
+
- lib/xsd_model/elements/base_element.rb
|
127
|
+
- lib/xsd_model/elements/choice.rb
|
128
|
+
- lib/xsd_model/elements/collection.rb
|
129
|
+
- lib/xsd_model/elements/comment.rb
|
130
|
+
- lib/xsd_model/elements/complex_content.rb
|
131
|
+
- lib/xsd_model/elements/complex_type.rb
|
132
|
+
- lib/xsd_model/elements/content.rb
|
133
|
+
- lib/xsd_model/elements/doctype.rb
|
134
|
+
- lib/xsd_model/elements/document.rb
|
135
|
+
- lib/xsd_model/elements/documentation.rb
|
136
|
+
- lib/xsd_model/elements/element.rb
|
137
|
+
- lib/xsd_model/elements/enumeration.rb
|
138
|
+
- lib/xsd_model/elements/extension.rb
|
139
|
+
- lib/xsd_model/elements/fraction_digits.rb
|
140
|
+
- lib/xsd_model/elements/group.rb
|
141
|
+
- lib/xsd_model/elements/import.rb
|
142
|
+
- lib/xsd_model/elements/include.rb
|
143
|
+
- lib/xsd_model/elements/length.rb
|
144
|
+
- lib/xsd_model/elements/logical.rb
|
145
|
+
- lib/xsd_model/elements/max_inclusive.rb
|
146
|
+
- lib/xsd_model/elements/max_length.rb
|
147
|
+
- lib/xsd_model/elements/min_exclusive.rb
|
148
|
+
- lib/xsd_model/elements/min_inclusive.rb
|
149
|
+
- lib/xsd_model/elements/min_length.rb
|
150
|
+
- lib/xsd_model/elements/pattern.rb
|
151
|
+
- lib/xsd_model/elements/requires.rb
|
152
|
+
- lib/xsd_model/elements/restriction.rb
|
153
|
+
- lib/xsd_model/elements/schema.rb
|
154
|
+
- lib/xsd_model/elements/schema_info.rb
|
155
|
+
- lib/xsd_model/elements/sequence.rb
|
156
|
+
- lib/xsd_model/elements/simple_content.rb
|
157
|
+
- lib/xsd_model/elements/simple_type.rb
|
158
|
+
- lib/xsd_model/elements/text.rb
|
159
|
+
- lib/xsd_model/elements/total_digits.rb
|
160
|
+
- lib/xsd_model/elements/union.rb
|
161
|
+
- lib/xsd_model/elements/white_space.rb
|
162
|
+
- lib/xsd_model/parser.rb
|
163
|
+
- lib/xsd_model/xsdize.rb
|
164
|
+
- subschema.xsd
|
165
|
+
- xsd_model.gemspec
|
166
|
+
homepage: https://github.com/Masa331/xsd_model
|
167
|
+
licenses:
|
168
|
+
- MIT
|
169
|
+
metadata: {}
|
170
|
+
post_install_message:
|
171
|
+
rdoc_options: []
|
172
|
+
require_paths:
|
173
|
+
- lib
|
174
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
requirements: []
|
185
|
+
rubyforge_project:
|
186
|
+
rubygems_version: 2.6.14.1
|
187
|
+
signing_key:
|
188
|
+
specification_version: 4
|
189
|
+
summary: XSD parser
|
190
|
+
test_files: []
|