summaryrefslogtreecommitdiff
path: root/lib/wsdl/xmlSchema
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wsdl/xmlSchema')
-rw-r--r--lib/wsdl/xmlSchema/all.rb65
-rw-r--r--lib/wsdl/xmlSchema/any.rb56
-rw-r--r--lib/wsdl/xmlSchema/attribute.rb74
-rw-r--r--lib/wsdl/xmlSchema/choice.rb65
-rw-r--r--lib/wsdl/xmlSchema/complexContent.rb83
-rw-r--r--lib/wsdl/xmlSchema/complexType.rb133
-rw-r--r--lib/wsdl/xmlSchema/content.rb96
-rw-r--r--lib/wsdl/xmlSchema/data.rb68
-rw-r--r--lib/wsdl/xmlSchema/element.rb104
-rw-r--r--lib/wsdl/xmlSchema/enumeration.rb36
-rw-r--r--lib/wsdl/xmlSchema/import.rb44
-rw-r--r--lib/wsdl/xmlSchema/parser.rb162
-rw-r--r--lib/wsdl/xmlSchema/schema.rb106
-rw-r--r--lib/wsdl/xmlSchema/sequence.rb65
-rw-r--r--lib/wsdl/xmlSchema/simpleRestriction.rb48
-rw-r--r--lib/wsdl/xmlSchema/simpleType.rb81
-rw-r--r--lib/wsdl/xmlSchema/unique.rb34
17 files changed, 0 insertions, 1320 deletions
diff --git a/lib/wsdl/xmlSchema/all.rb b/lib/wsdl/xmlSchema/all.rb
deleted file mode 100644
index 53f7ae82e4..0000000000
--- a/lib/wsdl/xmlSchema/all.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# WSDL4R - XMLSchema complexType definition for WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-
-
-module WSDL
-module XMLSchema
-
-
-class All < Info
- attr_reader :minoccurs
- attr_reader :maxoccurs
- attr_reader :elements
-
- def initialize
- super()
- @minoccurs = 1
- @maxoccurs = 1
- @elements = []
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def <<(element)
- @elements << element
- end
-
- def parse_element(element)
- case element
- when AnyName
- o = Any.new
- @elements << o
- o
- when ElementName
- o = Element.new
- @elements << o
- o
- else
- nil
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when MaxOccursAttrName
- @maxoccurs = value
- when MinOccursAttrName
- @minoccurs = value
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/any.rb b/lib/wsdl/xmlSchema/any.rb
deleted file mode 100644
index 3fc3706182..0000000000
--- a/lib/wsdl/xmlSchema/any.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-# WSDL4R - XMLSchema any definition for WSDL.
-# Copyright (C) 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-
-
-module WSDL
-module XMLSchema
-
-
-class Any < Info
- attr_accessor :maxoccurs
- attr_accessor :minoccurs
- attr_accessor :namespace
- attr_accessor :process_contents
-
- def initialize
- super()
- @maxoccurs = 1
- @minoccurs = 1
- @namespace = '##any'
- @process_contents = 'strict'
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def parse_element(element)
- nil
- end
-
- def parse_attr(attr, value)
- case attr
- when MaxOccursAttrName
- @maxoccurs = value
- when MinOccursAttrName
- @minoccurs = value
- when NamespaceAttrName
- @namespace = value
- when ProcessContentsAttrName
- @process_contents = value
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/attribute.rb b/lib/wsdl/xmlSchema/attribute.rb
deleted file mode 100644
index e5046dd991..0000000000
--- a/lib/wsdl/xmlSchema/attribute.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-# WSDL4R - XMLSchema attribute definition for WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-
-
-module WSDL
-module XMLSchema
-
-
-class Attribute < Info
- attr_accessor :ref
- attr_accessor :use
- attr_accessor :form
- attr_accessor :name
- attr_accessor :type
- attr_accessor :default
- attr_accessor :fixed
-
- attr_accessor :arytype
-
- def initialize
- super
- @ref = nil
- @use = nil
- @form = nil
- @name = nil
- @type = nil
- @default = nil
- @fixed = nil
-
- @arytype = nil
- end
-
- def parse_element(element)
- nil
- end
-
- def parse_attr(attr, value)
- case attr
- when RefAttrName
- @ref = value
- when UseAttrName
- @use = value
- when FormAttrName
- @form = value
- when NameAttrName
- @name = value
- when TypeAttrName
- @type = value
- when DefaultAttrName
- @default = value
- when FixedAttrName
- @fixed = value
- when ArrayTypeAttrName
- @arytype = if value.is_a?(XSD::QName)
- value
- else
- XSD::QName.new(XSD::Namespace, value)
- end
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/choice.rb b/lib/wsdl/xmlSchema/choice.rb
deleted file mode 100644
index 4cf481ec9e..0000000000
--- a/lib/wsdl/xmlSchema/choice.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# WSDL4R - XMLSchema complexType definition for WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-
-
-module WSDL
-module XMLSchema
-
-
-class Choice < Info
- attr_reader :minoccurs
- attr_reader :maxoccurs
- attr_reader :elements
-
- def initialize
- super()
- @minoccurs = 1
- @maxoccurs = 1
- @elements = []
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def <<(element)
- @elements << element
- end
-
- def parse_element(element)
- case element
- when AnyName
- o = Any.new
- @elements << o
- o
- when ElementName
- o = Element.new
- @elements << o
- o
- else
- nil
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when MaxOccursAttrName
- @maxoccurs = value
- when MinOccursAttrName
- @minoccurs = value
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/complexContent.rb b/lib/wsdl/xmlSchema/complexContent.rb
deleted file mode 100644
index 66ad9e251d..0000000000
--- a/lib/wsdl/xmlSchema/complexContent.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-# WSDL4R - XMLSchema complexContent definition for WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-require 'xsd/namedelements'
-
-
-module WSDL
-module XMLSchema
-
-
-class ComplexContent < Info
- attr_accessor :base
- attr_reader :derivetype
- attr_reader :content
- attr_reader :attributes
-
- def initialize
- super
- @base = nil
- @derivetype = nil
- @content = nil
- @attributes = XSD::NamedElements.new
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def parse_element(element)
- case element
- when RestrictionName, ExtensionName
- @derivetype = element.name
- self
- when AllName
- if @derivetype.nil?
- raise Parser::ElementConstraintError.new("base attr not found.")
- end
- @content = All.new
- @content
- when SequenceName
- if @derivetype.nil?
- raise Parser::ElementConstraintError.new("base attr not found.")
- end
- @content = Sequence.new
- @content
- when ChoiceName
- if @derivetype.nil?
- raise Parser::ElementConstraintError.new("base attr not found.")
- end
- @content = Choice.new
- @content
- when AttributeName
- if @derivetype.nil?
- raise Parser::ElementConstraintError.new("base attr not found.")
- end
- o = Attribute.new
- @attributes << o
- o
- end
- end
-
- def parse_attr(attr, value)
- if @derivetype.nil?
- return nil
- end
- case attr
- when BaseAttrName
- @base = value
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/complexType.rb b/lib/wsdl/xmlSchema/complexType.rb
deleted file mode 100644
index 056a806dc5..0000000000
--- a/lib/wsdl/xmlSchema/complexType.rb
+++ /dev/null
@@ -1,133 +0,0 @@
-# WSDL4R - XMLSchema complexType definition for WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-require 'wsdl/xmlSchema/content'
-require 'wsdl/xmlSchema/element'
-require 'xsd/namedelements'
-
-
-module WSDL
-module XMLSchema
-
-
-class ComplexType < Info
- attr_accessor :name
- attr_accessor :complexcontent
- attr_accessor :content
- attr_accessor :final
- attr_accessor :mixed
- attr_reader :attributes
-
- def initialize(name = nil)
- super()
- @name = name
- @complexcontent = nil
- @content = nil
- @final = nil
- @mixed = false
- @attributes = XSD::NamedElements.new
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- AnyAsElement = Element.new(XSD::QName.new(nil, 'any'), XSD::AnyTypeName)
- def each_element
- if @content
- @content.elements.each do |element|
- if element.is_a?(Any)
- yield(AnyAsElement)
- else
- yield(element)
- end
- end
- end
- end
-
- def find_element(name)
- if @content
- @content.elements.each do |element|
- if element.is_a?(Any)
- return AnyAsElement if name == AnyAsElement.name
- else
- return element if name == element.name
- end
- end
- end
- nil
- end
-
- def find_element_by_name(name)
- if @content
- @content.elements.each do |element|
- if element.is_a?(Any)
- return AnyAsElement if name == AnyAsElement.name.name
- else
- return element if name == element.name.name
- end
- end
- end
- nil
- end
-
- def sequence_elements=(elements)
- @content = Sequence.new
- elements.each do |element|
- @content << element
- end
- end
-
- def all_elements=(elements)
- @content = All.new
- elements.each do |element|
- @content << element
- end
- end
-
- def parse_element(element)
- case element
- when AllName
- @content = All.new
- @content
- when SequenceName
- @content = Sequence.new
- @content
- when ChoiceName
- @content = Choice.new
- @content
- when ComplexContentName
- @complexcontent = ComplexContent.new
- @complexcontent
- when AttributeName
- o = Attribute.new
- @attributes << o
- o
- else
- nil
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when FinalAttrName
- @final = value
- when MixedAttrName
- @mixed = (value == 'true')
- when NameAttrName
- @name = XSD::QName.new(targetnamespace, value)
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/content.rb b/lib/wsdl/xmlSchema/content.rb
deleted file mode 100644
index 3aa875e3e7..0000000000
--- a/lib/wsdl/xmlSchema/content.rb
+++ /dev/null
@@ -1,96 +0,0 @@
-# WSDL4R - XMLSchema complexType definition for WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-
-
-module WSDL
-module XMLSchema
-
-
-class Content < Info
- attr_accessor :final
- attr_accessor :mixed
- attr_accessor :type
- attr_reader :contents
- attr_reader :elements
-
- def initialize
- super()
- @final = nil
- @mixed = false
- @type = nil
- @contents = []
- @elements = []
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def <<(content)
- @contents << content
- update_elements
- end
-
- def each
- @contents.each do |content|
- yield content
- end
- end
-
- def parse_element(element)
- case element
- when AllName, SequenceName, ChoiceName
- o = Content.new
- o.type = element.name
- @contents << o
- o
- when AnyName
- o = Any.new
- @contents << o
- o
- when ElementName
- o = Element.new
- @contents << o
- o
- else
- nil
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when FinalAttrName
- @final = value
- when MixedAttrName
- @mixed = (value == 'true')
- else
- nil
- end
- end
-
- def parse_epilogue
- update_elements
- end
-
-private
-
- def update_elements
- @elements = []
- @contents.each do |content|
- if content.is_a?(Element)
- @elements << [content.name, content]
- end
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/data.rb b/lib/wsdl/xmlSchema/data.rb
deleted file mode 100644
index 1283ac2a1d..0000000000
--- a/lib/wsdl/xmlSchema/data.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-# WSDL4R - XMLSchema data definitions.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'xsd/datatypes'
-require 'wsdl/xmlSchema/schema'
-require 'wsdl/xmlSchema/import'
-require 'wsdl/xmlSchema/simpleType'
-require 'wsdl/xmlSchema/simpleRestriction'
-require 'wsdl/xmlSchema/complexType'
-require 'wsdl/xmlSchema/complexContent'
-require 'wsdl/xmlSchema/any'
-require 'wsdl/xmlSchema/element'
-require 'wsdl/xmlSchema/all'
-require 'wsdl/xmlSchema/choice'
-require 'wsdl/xmlSchema/sequence'
-require 'wsdl/xmlSchema/attribute'
-require 'wsdl/xmlSchema/unique'
-require 'wsdl/xmlSchema/enumeration'
-
-module WSDL
-module XMLSchema
-
-
-AllName = XSD::QName.new(XSD::Namespace, 'all')
-AnyName = XSD::QName.new(XSD::Namespace, 'any')
-AttributeName = XSD::QName.new(XSD::Namespace, 'attribute')
-ChoiceName = XSD::QName.new(XSD::Namespace, 'choice')
-ComplexContentName = XSD::QName.new(XSD::Namespace, 'complexContent')
-ComplexTypeName = XSD::QName.new(XSD::Namespace, 'complexType')
-ElementName = XSD::QName.new(XSD::Namespace, 'element')
-EnumerationName = XSD::QName.new(XSD::Namespace, 'enumeration')
-ExtensionName = XSD::QName.new(XSD::Namespace, 'extension')
-ImportName = XSD::QName.new(XSD::Namespace, 'import')
-RestrictionName = XSD::QName.new(XSD::Namespace, 'restriction')
-SequenceName = XSD::QName.new(XSD::Namespace, 'sequence')
-SchemaName = XSD::QName.new(XSD::Namespace, 'schema')
-SimpleTypeName = XSD::QName.new(XSD::Namespace, 'simpleType')
-UniqueName = XSD::QName.new(XSD::Namespace, 'unique')
-
-AttributeFormDefaultAttrName = XSD::QName.new(nil, 'attributeFormDefault')
-BaseAttrName = XSD::QName.new(nil, 'base')
-DefaultAttrName = XSD::QName.new(nil, 'default')
-ElementFormDefaultAttrName = XSD::QName.new(nil, 'elementFormDefault')
-FinalAttrName = XSD::QName.new(nil, 'final')
-FixedAttrName = XSD::QName.new(nil, 'fixed')
-FormAttrName = XSD::QName.new(nil, 'form')
-IdAttrName = XSD::QName.new(nil, 'id')
-MaxOccursAttrName = XSD::QName.new(nil, 'maxOccurs')
-MinOccursAttrName = XSD::QName.new(nil, 'minOccurs')
-MixedAttrName = XSD::QName.new(nil, 'mixed')
-NameAttrName = XSD::QName.new(nil, 'name')
-NamespaceAttrName = XSD::QName.new(nil, 'namespace')
-NillableAttrName = XSD::QName.new(nil, 'nillable')
-RefAttrName = XSD::QName.new(nil, 'ref')
-SchemaLocationAttrName = XSD::QName.new(nil, 'schemaLocation')
-TargetNamespaceAttrName = XSD::QName.new(nil, 'targetNamespace')
-TypeAttrName = XSD::QName.new(nil, 'type')
-UseAttrName = XSD::QName.new(nil, 'use')
-ValueAttrName = XSD::QName.new(nil, 'value')
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/element.rb b/lib/wsdl/xmlSchema/element.rb
deleted file mode 100644
index 90e8c0d5d1..0000000000
--- a/lib/wsdl/xmlSchema/element.rb
+++ /dev/null
@@ -1,104 +0,0 @@
-# WSDL4R - XMLSchema element definition for WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-
-
-module WSDL
-module XMLSchema
-
-
-class Element < Info
- attr_accessor :name # required
- attr_accessor :type
- attr_accessor :local_complextype
- attr_accessor :constraint
- attr_accessor :maxoccurs
- attr_accessor :minoccurs
- attr_accessor :nillable
-
- def initialize(name = nil, type = XSD::AnyTypeName)
- super()
- @name = name
- @type = type
- @local_complextype = nil
- @constraint = nil
- @maxoccurs = 1
- @minoccurs = 1
- @nillable = nil
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def parse_element(element)
- case element
- when ComplexTypeName
- @type = nil
- @local_complextype = ComplexType.new
- @local_complextype
- when UniqueName
- @constraint = Unique.new
- @constraint
- else
- nil
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when NameAttrName
- #@name = XSD::QName.new(nil, value)
- @name = XSD::QName.new(targetnamespace, value)
- when TypeAttrName
- @type = if value.is_a?(XSD::QName)
- value
- else
- XSD::QName.new(XSD::Namespace, value)
- end
- when MaxOccursAttrName
- case parent
- when All
- if value != '1'
- raise Parser::AttrConstraintError.new(
- "Cannot parse #{ value } for #{ attr }.")
- end
- @maxoccurs = value
- when Sequence
- @maxoccurs = value
- else
- raise NotImplementedError.new
- end
- @maxoccurs
- when MinOccursAttrName
- case parent
- when All
- if ['0', '1'].include?(value)
- @minoccurs = value
- else
- raise Parser::AttrConstraintError.new(
- "Cannot parse #{ value } for #{ attr }.")
- end
- when Sequence
- @minoccurs = value
- else
- raise NotImplementedError.new
- end
- @minoccurs
- when NillableAttrName
- @nillable = (value == 'true')
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/enumeration.rb b/lib/wsdl/xmlSchema/enumeration.rb
deleted file mode 100644
index cd61572d07..0000000000
--- a/lib/wsdl/xmlSchema/enumeration.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# WSDL4R - XMLSchema enumeration definition for WSDL.
-# Copyright (C) 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-
-
-module WSDL
-module XMLSchema
-
-
-class Enumeration < Info
- def initialize
- super
- end
-
- def parse_element(element)
- nil
- end
-
- def parse_attr(attr, value)
- case attr
- when ValueAttrName
- parent.enumeration << value
- value
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/import.rb b/lib/wsdl/xmlSchema/import.rb
deleted file mode 100644
index 2ef3b72ab2..0000000000
--- a/lib/wsdl/xmlSchema/import.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# WSDL4R - XMLSchema import definition.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-
-
-module WSDL
-module XMLSchema
-
-
-class Import < Info
- attr_reader :namespace
- attr_reader :schemalocation
-
- def initialize
- super
- @namespace = nil
- @schemalocation = nil
- end
-
- def parse_element(element)
- nil
- end
-
- def parse_attr(attr, value)
- case attr
- when NamespaceAttrName
- @namespace = value
- when SchemaLocationAttrName
- @schemalocation = value
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/parser.rb b/lib/wsdl/xmlSchema/parser.rb
deleted file mode 100644
index 5401c5f729..0000000000
--- a/lib/wsdl/xmlSchema/parser.rb
+++ /dev/null
@@ -1,162 +0,0 @@
-# WSDL4R - WSDL XML Instance parser library.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'xsd/qname'
-require 'xsd/ns'
-require 'xsd/charset'
-require 'xsd/datatypes'
-require 'xsd/xmlparser'
-require 'wsdl/xmlSchema/data'
-
-
-module WSDL
-module XMLSchema
-
-
-class Parser
- include XSD
-
- class ParseError < Error; end
- class FormatDecodeError < Error; end
- class UnknownElementError < FormatDecodeError; end
- class UnknownAttributeError < FormatDecodeError; end
- class UnexpectedElementError < FormatDecodeError; end
- class ElementConstraintError < FormatDecodeError; end
- class AttributeConstraintError < FormatDecodeError; end
-
-private
-
- class ParseFrame
- attr_reader :ns
- attr_reader :name
- attr_accessor :node
-
- private
-
- def initialize(ns, name, node)
- @ns = ns
- @name = name
- @node = node
- end
- end
-
-public
-
- def initialize(opt = {})
- @parser = XSD::XMLParser.create_parser(self, opt)
- @parsestack = nil
- @lastnode = nil
- end
-
- def parse(string_or_readable)
- @parsestack = []
- @lastnode = nil
- @textbuf = ''
- @parser.do_parse(string_or_readable)
- @lastnode
- end
-
- def charset
- @parser.charset
- end
-
- def start_element(name, attrs)
- lastframe = @parsestack.last
- ns = parent = nil
- if lastframe
- ns = lastframe.ns.clone_ns
- parent = lastframe.node
- else
- ns = XSD::NS.new
- parent = nil
- end
- attrs = XSD::XMLParser.filter_ns(ns, attrs)
- node = decode_tag(ns, name, attrs, parent)
- @parsestack << ParseFrame.new(ns, name, node)
- end
-
- def characters(text)
- lastframe = @parsestack.last
- if lastframe
- # Need not to be cloned because character does not have attr.
- ns = lastframe.ns
- decode_text(ns, text)
- else
- p text if $DEBUG
- end
- end
-
- def end_element(name)
- lastframe = @parsestack.pop
- unless name == lastframe.name
- raise UnexpectedElementError.new("Closing element name '#{ name }' does not match with opening element '#{ lastframe.name }'.")
- end
- decode_tag_end(lastframe.ns, lastframe.node)
- @lastnode = lastframe.node
- end
-
-private
-
- def decode_tag(ns, name, attrs, parent)
- o = nil
- element = ns.parse(name)
- if !parent
- if element == SchemaName
- o = Schema.parse_element(element)
- else
- raise UnknownElementError.new("Unknown element #{ element }.")
- end
- else
- o = parent.parse_element(element)
- unless o
- raise UnknownElementError.new("Unknown element #{ element }.")
- end
- # node could be a pseudo element. pseudo element has its own parent.
- o.parent = parent if o.parent.nil?
- end
- attrs.each do |key, value|
- attr = unless /:/ =~ key
- XSD::QName.new(nil, key)
- else
- ns.parse(key)
- end
- value_ele = if /:/ !~ value
- value
- elsif /^http:\/\// =~ value # ToDo: ugly.
- value
- else
- begin
- ns.parse(value)
- rescue
- value
- end
- end
- if attr == IdAttrName
- o.id = value_ele
- else
- unless o.parse_attr(attr, value_ele)
- STDERR.puts("Unknown attr #{ attr }.")
- # raise UnknownAttributeError.new("Unknown attr #{ attr }.")
- end
- end
- end
- o
- end
-
- def decode_tag_end(ns, node)
- node.parse_epilogue
- end
-
- def decode_text(ns, text)
- @textbuf << text
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/schema.rb b/lib/wsdl/xmlSchema/schema.rb
deleted file mode 100644
index b530a92556..0000000000
--- a/lib/wsdl/xmlSchema/schema.rb
+++ /dev/null
@@ -1,106 +0,0 @@
-# WSDL4R - XMLSchema schema definition for WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-require 'xsd/namedelements'
-
-
-module WSDL
-module XMLSchema
-
-
-class Schema < Info
- attr_reader :targetnamespace # required
- attr_reader :complextypes
- attr_reader :simpletypes
- attr_reader :elements
- attr_reader :attributes
- attr_reader :imports
- attr_accessor :attributeformdefault
- attr_accessor :elementformdefault
-
- def initialize
- super
- @targetnamespace = nil
- @complextypes = XSD::NamedElements.new
- @simpletypes = XSD::NamedElements.new
- @elements = XSD::NamedElements.new
- @attributes = XSD::NamedElements.new
- @imports = []
- @elementformdefault = nil
- end
-
- def parse_element(element)
- case element
- when ImportName
- o = Import.new
- @imports << o
- o
- when ComplexTypeName
- o = ComplexType.new
- @complextypes << o
- o
- when SimpleTypeName
- o = SimpleType.new
- @simpletypes << o
- o
- when ElementName
- o = Element.new
- @elements << o
- o
- when AttributeName
- o = Attribute.new
- o
- else
- nil
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when TargetNamespaceAttrName
- @targetnamespace = value
- when AttributeFormDefaultAttrName
- @attributeformdefault = value
- when ElementFormDefaultAttrName
- @elementformdefault = value
- else
- nil
- end
- end
-
- def collect_elements
- result = XSD::NamedElements.new
- result.concat(@elements)
- result
- end
-
- def collect_complextypes
- result = XSD::NamedElements.new
- result.concat(@complextypes)
- result
- end
-
- def collect_simpletypes
- result = XSD::NamedElements.new
- result.concat(@simpletypes)
- result
- end
-
- def self.parse_element(element)
- if element == SchemaName
- Schema.new
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/sequence.rb b/lib/wsdl/xmlSchema/sequence.rb
deleted file mode 100644
index 3810832ab2..0000000000
--- a/lib/wsdl/xmlSchema/sequence.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# WSDL4R - XMLSchema complexType definition for WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-
-
-module WSDL
-module XMLSchema
-
-
-class Sequence < Info
- attr_reader :minoccurs
- attr_reader :maxoccurs
- attr_reader :elements
-
- def initialize
- super()
- @minoccurs = 1
- @maxoccurs = 1
- @elements = []
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def <<(element)
- @elements << element
- end
-
- def parse_element(element)
- case element
- when AnyName
- o = Any.new
- @elements << o
- o
- when ElementName
- o = Element.new
- @elements << o
- o
- else
- nil
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when MaxOccursAttrName
- @maxoccurs = value
- when MinOccursAttrName
- @minoccurs = value
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/simpleRestriction.rb b/lib/wsdl/xmlSchema/simpleRestriction.rb
deleted file mode 100644
index 6986e74423..0000000000
--- a/lib/wsdl/xmlSchema/simpleRestriction.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-# WSDL4R - XMLSchema simpleType definition for WSDL.
-# Copyright (C) 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-require 'xsd/namedelements'
-
-
-module WSDL
-module XMLSchema
-
-
-class SimpleRestriction < Info
- attr_reader :base
- attr_reader :enumeration
-
- def initialize
- super
- @base = nil
- @enumeration = [] # NamedElements?
- end
-
- def valid?(value)
- @enumeration.include?(value)
- end
-
- def parse_element(element)
- case element
- when EnumerationName
- Enumeration.new # just a parsing handler
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when BaseAttrName
- @base = value
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/simpleType.rb b/lib/wsdl/xmlSchema/simpleType.rb
deleted file mode 100644
index 830086f99e..0000000000
--- a/lib/wsdl/xmlSchema/simpleType.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-# WSDL4R - XMLSchema simpleType definition for WSDL.
-# Copyright (C) 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-require 'xsd/namedelements'
-
-
-module WSDL
-module XMLSchema
-
-
-class SimpleType < Info
- attr_accessor :name
- attr_reader :derivetype
- attr_reader :restriction
-
- def check_lexical_format(value)
- if @restriction
- check_restriction(value)
- elsif @extension
- raise NotImplementedError
- # ToDo
- else
- raise ArgumentError.new("incomplete simpleType")
- end
- end
-
- def base
- if @restriction
- @restriction.base
- elsif @extension
- @extension.base
- else
- raise ArgumentError.new("incomplete simpleType")
- end
- end
-
- def initialize(name = nil)
- super()
- @name = name
- @derivetype = nil
- @restriction = nil
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def parse_element(element)
- case element
- when RestrictionName
- @restriction = SimpleRestriction.new
- @derivetype = element.name
- @restriction
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when NameAttrName
- @name = XSD::QName.new(targetnamespace, value)
- end
- end
-
-private
-
- def check_restriction(value)
- unless @restriction.valid?(value)
- raise ::XSD::ValueSpaceError.new("#{@name}: cannot accept '#{value}'.")
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/unique.rb b/lib/wsdl/xmlSchema/unique.rb
deleted file mode 100644
index 837ff22b4a..0000000000
--- a/lib/wsdl/xmlSchema/unique.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# WSDL4R - XMLSchema unique element.
-# Copyright (C) 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
-
-# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
-# redistribute it and/or modify it under the same terms of Ruby's license;
-# either the dual license version in 2003, or any later version.
-
-
-require 'wsdl/info'
-
-
-module WSDL
-module XMLSchema
-
-
-class Unique < Info
- def initialize
- super
- end
-
- def parse_element(element)
- # Accepts any element.
- self
- end
-
- def parse_attr(attr, value)
- # Accepts any attribute.
- true
- end
-end
-
-
-end
-end