Class: RXSD::XSD::AttributeGroup
- Inherits:
-
Object
- Object
- RXSD::XSD::AttributeGroup
- Defined in:
- lib/rxsd/xsd/attribute_group.rb
Overview
XSD AttributeGroup defintion www.w3schools.com/Schema/el_attributegroup.asp
Instance Attribute Summary collapse
-
#attribute_groups ⇒ Object
attribute group children.
-
#attributes ⇒ Object
attribute group children.
-
#id ⇒ Object
attribute group attributes.
-
#name ⇒ Object
attribute group attributes.
-
#parent ⇒ Object
attribute group parent.
-
#ref ⇒ Object
attribute group attributes.
Class Method Summary collapse
-
.from_xml(node) ⇒ Object
node passed in should be a xml node representing the attribute group.
-
.tag_name ⇒ Object
xml tag name.
Instance Method Summary collapse
-
#child_attributes ⇒ Object
return all child attributes associated w/ attribute group.
-
#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_builders ⇒ Object
convert attribute group to array of class builders.
Instance Attribute Details
#attribute_groups ⇒ Object
attribute group children
17 18 19 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 17 def attribute_groups @attribute_groups end |
#attributes ⇒ Object
attribute group children
17 18 19 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 17 def attributes @attributes end |
#id ⇒ Object
attribute group attributes
14 15 16 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 14 def id @id end |
#name ⇒ Object
attribute group attributes
14 15 16 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 14 def name @name end |
#parent ⇒ Object
attribute group parent
20 21 22 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 20 def parent @parent end |
#ref ⇒ Object
attribute group attributes
14 15 16 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 14 def ref @ref end |
Class Method Details
.from_xml(node) ⇒ Object
node passed in should be a xml node representing the attribute group
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 38 def self.from_xml(node) attribute_group = AttributeGroup.new attribute_group.parent = node.parent. node. = attribute_group # TODO attribute group attributes: | anyAttributes attribute_group.id = node.attrs["id"] attribute_group.name = node.attrs["name"] attribute_group.ref = node.attrs["ref"] # TODO attribute group children: | anyAttribute attribute_group.attributes = node.children_objs Attribute attribute_group.attribute_groups = node.children_objs AttributeGroup return attribute_group end |
.tag_name ⇒ Object
xml tag name
23 24 25 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 23 def self.tag_name "attributeGroup" end |
Instance Method Details
#child_attributes ⇒ Object
return all child attributes associated w/ attribute group
80 81 82 83 84 85 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 80 def child_attributes atts = [] @attribute_groups.each { |atg| atts += atg.child_attributes } unless @attribute_groups.nil? @attributes.each { |att| atts += att.child_attributes } unless @attributes.nil? return atts end |
#children ⇒ Object
returns array of all children
33 34 35 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 33 def children @attributes + @attribute_groups end |
#info ⇒ Object
return xsd node info
28 29 30 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 28 def info "attributeGroup id: #{@id} name: #{@name} ref: #{ref.nil? ? "" : ref.class == String ? ref : ref.name} " end |
#resolve(node_objs) ⇒ Object
resolve hanging references given complete xsd node object array
56 57 58 59 60 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 56 def resolve(node_objs) unless @ref.nil? @ref = node_objs[AttributeGroup].find { |no| no.name == @ref } end end |
#to_class_builders ⇒ Object
convert attribute group to array of class builders
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/rxsd/xsd/attribute_group.rb', line 63 def to_class_builders unless defined? @class_builders @class_builders = [] @attributes.each { |att| @class_builders.push att.to_class_builder } @attribute_groups.each { |atg| atg.to_class_builders.each { |atcb| @class_builders.push atcb } } end return @class_builders end |