Class: Lutaml::Xsd::Spa::XmlInstanceGenerator
- Inherits:
-
Object
- Object
- Lutaml::Xsd::Spa::XmlInstanceGenerator
- Includes:
- Utils::ExtractEnumeration
- Defined in:
- lib/lutaml/xsd/spa/xml_instance_generator.rb
Overview
Generates XML instance representations showing how to use XSD components Based on xs3p’s SampleInstanceTable templates
Instance Attribute Summary collapse
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
-
#generate ⇒ Object
Generate instance representation.
-
#initialize(schema, component, repository = nil, all_schemas: nil) ⇒ XmlInstanceGenerator
constructor
A new instance of XmlInstanceGenerator.
Methods included from Utils::ExtractEnumeration
#extract_enumeration_default, #extract_enumeration_values
Constructor Details
#initialize(schema, component, repository = nil, all_schemas: nil) ⇒ XmlInstanceGenerator
Returns a new instance of XmlInstanceGenerator.
15 16 17 18 19 20 21 |
# File 'lib/lutaml/xsd/spa/xml_instance_generator.rb', line 15 def initialize(schema, component, repository = nil, all_schemas: nil) @schema = schema @component = component @repository = repository @all_schemas = all_schemas || {} @visited_types = [] end |
Instance Attribute Details
#component ⇒ Object (readonly)
Returns the value of attribute component.
13 14 15 |
# File 'lib/lutaml/xsd/spa/xml_instance_generator.rb', line 13 def component @component end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
13 14 15 |
# File 'lib/lutaml/xsd/spa/xml_instance_generator.rb', line 13 def repository @repository end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
13 14 15 |
# File 'lib/lutaml/xsd/spa/xml_instance_generator.rb', line 13 def schema @schema end |
Instance Method Details
#generate ⇒ Object
Generate instance representation
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/lutaml/xsd/spa/xml_instance_generator.rb', line 24 def generate case @component when Element generate_element_instance(@component) when ComplexType generate_type_instance(@component) when SimpleType generate_simple_type_instance(@component) when AttributeGroup generate_ag_instance(@component) else "<!-- Unknown component type -->" end end |