Class: RXSD::XSD::SimpleType
- Inherits:
-
Object
- Object
- RXSD::XSD::SimpleType
- Defined in:
- lib/rxsd/xsd/simple_type.rb
Overview
XSD SimpleType defintion www.w3schools.com/Schema/el_simpletype.asp
Instance Attribute Summary collapse
-
#id ⇒ Object
simple type attribute values.
-
#list ⇒ Object
children in schema (only one will be populated).
-
#name ⇒ Object
simple type attribute values.
-
#parent ⇒ Object
simpleType parent.
-
#restriction ⇒ Object
children in schema (only one will be populated).
Class Method Summary collapse
-
.from_xml(node) ⇒ Object
node passed in should be a xml node representing the simple type.
-
.tag_name ⇒ Object
xml tag name.
Instance Method Summary collapse
-
#child_attributes ⇒ Object
return all child_attributes associated w/ simple type.
-
#children ⇒ Object
returns array of all children.
-
#info ⇒ Object
return xsd node info.
-
#resolve(node_objs) ⇒ Object
resolve hanging references given complete xsd node object array.
-
#to_class_builder ⇒ Object
convert simple type to class builder.
Instance Attribute Details
#id ⇒ Object
simple type attribute values
14 15 16 |
# File 'lib/rxsd/xsd/simple_type.rb', line 14 def id @id end |
#list ⇒ Object
children in schema (only one will be populated)
17 18 19 |
# File 'lib/rxsd/xsd/simple_type.rb', line 17 def list @list end |
#name ⇒ Object
simple type attribute values
14 15 16 |
# File 'lib/rxsd/xsd/simple_type.rb', line 14 def name @name end |
#parent ⇒ Object
simpleType parent
20 21 22 |
# File 'lib/rxsd/xsd/simple_type.rb', line 20 def parent @parent end |
#restriction ⇒ Object
children in schema (only one will be populated)
17 18 19 |
# File 'lib/rxsd/xsd/simple_type.rb', line 17 def restriction @restriction end |
Class Method Details
.from_xml(node) ⇒ Object
node passed in should be a xml node representing the simple type
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rxsd/xsd/simple_type.rb', line 41 def self.from_xml(node) simpleType = SimpleType.new simpleType.parent = node.parent. node. = simpleType # TODO simpleType attributes: | anyAttr simpleType.id = node.attrs["id"] simpleType.name = node.attrs["name"] # parse lists simpleType.list = node.child_obj List # parse restrictions simpleType.restriction = node.child_obj Restriction # TODO simpleType children: | unions #simpleType.unions = node.child_obj Union return simpleType end |
.tag_name ⇒ Object
xml tag name
23 24 25 |
# File 'lib/rxsd/xsd/simple_type.rb', line 23 def self.tag_name "simpleType" end |
Instance Method Details
#child_attributes ⇒ Object
return all child_attributes associated w/ simple type
90 91 92 93 94 95 96 |
# File 'lib/rxsd/xsd/simple_type.rb', line 90 def child_attributes if !@list.nil? return @list.child_attributes elsif !@restriction.nil? return @restriction.child_attributes end end |
#children ⇒ Object
returns array of all children
33 34 35 36 37 38 |
# File 'lib/rxsd/xsd/simple_type.rb', line 33 def children c = [] c.push @list unless @list.nil? c.push @restriction unless @restriction.nil? return c end |
#info ⇒ Object
return xsd node info
28 29 30 |
# File 'lib/rxsd/xsd/simple_type.rb', line 28 def info "simple_type id: #{@id} name: #{@name}" end |
#resolve(node_objs) ⇒ Object
resolve hanging references given complete xsd node object array
63 64 |
# File 'lib/rxsd/xsd/simple_type.rb', line 63 def resolve(node_objs) end |
#to_class_builder ⇒ Object
convert simple type to class builder
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/rxsd/xsd/simple_type.rb', line 67 def to_class_builder unless defined? @class_builder @class_builder = nil if !@list.nil? # dispatch to child list @class_builder = @list.to_class_builder elsif !@restriction.nil? # grab restriction class builder w/ base class and facets @class_builder = @restriction.to_class_builder #else # @class_builder = ClassBuilder.new end end @class_builder.klass_name = @name.camelize unless @name.nil? return @class_builder end |