Class: RXSD::XSD::SimpleContent
- Inherits:
-
Object
- Object
- RXSD::XSD::SimpleContent
- Defined in:
- lib/rxsd/xsd/simple_content.rb
Overview
XSD SimpleContent defintion www.w3schools.com/Schema/el_simpleContent.asp
Instance Attribute Summary collapse
-
#extension ⇒ Object
simple content children.
-
#id ⇒ Object
simple content attributes.
-
#parent ⇒ Object
simple content parent.
-
#restriction ⇒ Object
simple content children.
Class Method Summary collapse
-
.from_xml(node) ⇒ Object
node passed in should be a xml node representing the group.
-
.tag_name ⇒ Object
xml tag name.
Instance Method Summary collapse
-
#child_attributes ⇒ Object
return all child attributes associated w/ simple content.
-
#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(cb = nil) ⇒ Object
convert simple content to class builder.
Instance Attribute Details
#extension ⇒ Object
simple content children
17 18 19 |
# File 'lib/rxsd/xsd/simple_content.rb', line 17 def extension @extension end |
#id ⇒ Object
simple content attributes
14 15 16 |
# File 'lib/rxsd/xsd/simple_content.rb', line 14 def id @id end |
#parent ⇒ Object
simple content parent
20 21 22 |
# File 'lib/rxsd/xsd/simple_content.rb', line 20 def parent @parent end |
#restriction ⇒ Object
simple content children
17 18 19 |
# File 'lib/rxsd/xsd/simple_content.rb', line 17 def restriction @restriction end |
Class Method Details
.from_xml(node) ⇒ Object
node passed in should be a xml node representing the group
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rxsd/xsd/simple_content.rb', line 41 def self.from_xml(node) simple_content = SimpleContent.new simple_content.parent = node.parent. node. = simple_content # TODO group attributes: | anyAttributes simple_content.id = node.attrs["id"] simple_content.restriction = node.child_obj Restriction simple_content.extension = node.child_obj Extension return simple_content end |
.tag_name ⇒ Object
xml tag name
23 24 25 |
# File 'lib/rxsd/xsd/simple_content.rb', line 23 def self.tag_name "simpleContent" end |
Instance Method Details
#child_attributes ⇒ Object
return all child attributes associated w/ simple content
76 77 78 79 80 81 |
# File 'lib/rxsd/xsd/simple_content.rb', line 76 def child_attributes atts = [] atts += @restriction.child_attributes unless @restriction.nil? atts += @extension.child_attributes unless @extension.nil? return atts end |
#children ⇒ Object
returns array of all children
33 34 35 36 37 38 |
# File 'lib/rxsd/xsd/simple_content.rb', line 33 def children c = [] c.push @restriction unless @restriction.nil? c.push @extension unless @extension.nil? return c end |
#info ⇒ Object
return xsd node info
28 29 30 |
# File 'lib/rxsd/xsd/simple_content.rb', line 28 def info "simple_content id: #{@id}" end |
#resolve(node_objs) ⇒ Object
resolve hanging references given complete xsd node object array
56 57 |
# File 'lib/rxsd/xsd/simple_content.rb', line 56 def resolve(node_objs) end |
#to_class_builder(cb = nil) ⇒ Object
convert simple content to class builder
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/rxsd/xsd/simple_content.rb', line 60 def to_class_builder(cb = nil) unless defined? @class_builder # dispatch to child restriction/extension @class_builder = cb if !@restriction.nil? @class_builder= @restriction.to_class_builder(@class_builder) elsif !@extension.nil? @class_builder= @extension.to_class_builder(@class_builder) end end return @class_builder end |