Class: Lutaml::Xsd::Validation::Rules::ElementStructureRule
- Inherits:
-
ValidationRule
- Object
- ValidationRule
- Lutaml::Xsd::Validation::Rules::ElementStructureRule
- Defined in:
- lib/lutaml/xsd/validation/rules/element_structure_rule.rb
Overview
ElementStructureRule validates element existence and structure
This rule checks:
-
Element is defined in schema
-
Element name matches schema definition
-
Namespace is correct
-
Provides suggestions for similar elements if not found
Based on Jing validator element validation algorithm.
Constant Summary
Constants inherited from ValidationRule
Instance Attribute Summary
Attributes inherited from ValidationRule
Instance Method Summary collapse
-
#category ⇒ Symbol
Rule category.
-
#description ⇒ String
Rule description.
-
#validate(xml_element, schema_element, collector) ⇒ void
Validate element structure.
Methods inherited from ValidationRule
#applicable?, #disable!, #enable!, #enabled?, #initialize, #inspect, #option, #priority, #to_h, #to_s
Constructor Details
This class inherits a constructor from Lutaml::Xsd::Validation::ValidationRule
Instance Method Details
#category ⇒ Symbol
Rule category
28 29 30 |
# File 'lib/lutaml/xsd/validation/rules/element_structure_rule.rb', line 28 def category :structure end |
#description ⇒ String
Rule description
35 36 37 |
# File 'lib/lutaml/xsd/validation/rules/element_structure_rule.rb', line 35 def description "Validates element existence, name, and namespace correctness" end |
#validate(xml_element, schema_element, collector) ⇒ void
This method returns an undefined value.
Validate element structure
Performs structural validation of XML elements against schema definitions, including element existence, name matching, and namespace validation.
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/lutaml/xsd/validation/rules/element_structure_rule.rb', line 51 def validate(xml_element, schema_element, collector) # Step 1: Validate element declaration exists unless validate_element_exists(xml_element, schema_element, collector) return end # Step 2: Validate element name matches validate_element_name(xml_element, schema_element, collector) # Step 3: Validate namespace correctness validate_namespace(xml_element, schema_element, collector) end |