Class: Lutaml::Xml::InheritedNamespaceStrategy

Inherits:
NamespaceResolutionStrategy show all
Defined in:
lib/lutaml/xml/namespace_resolution_strategy.rb

Overview

Strategy for elements inheriting parent namespace

Used when element should inherit the namespace from its parent element, such as when ‘element_form_default: :qualified` is set and no explicit namespace directive is given.

Examples:

Inheriting default namespace

<parent xmlns="http://example.com">
  <child>value</child>  <!-- inherits default namespace -->
</parent>

Inheriting prefixed namespace

<test:parent xmlns:test="http://example.com">
  <test:child>value</test:child>  <!-- inherits prefix -->
</test:parent>

Instance Attribute Summary

Attributes inherited from NamespaceResolutionStrategy

#namespace_uri, #prefix, #requires_blank_xmlns, #use_prefix

Instance Method Summary collapse

Methods inherited from NamespaceResolutionStrategy

#resolve

Constructor Details

#initialize(parent_ns_decl) ⇒ InheritedNamespaceStrategy

Initialize from parent namespace declaration

Parameters:



105
106
107
108
109
110
111
# File 'lib/lutaml/xml/namespace_resolution_strategy.rb', line 105

def initialize(parent_ns_decl)
  super(
    use_prefix: parent_ns_decl.prefix_format?,
    prefix: parent_ns_decl.prefix,
    namespace_uri: parent_ns_decl.uri
  )
end