class Lutaml::Model::XmlAdapter::Builder::Ox
def create_and_add_element(element_name, prefix: nil, attributes: {})
def create_and_add_element(element_name, prefix: nil, attributes: {}) prefixed_name = if prefix "#{prefix}:#{element_name}" elsif @current_namespace && !element_name.start_with?("#{@current_namespace}:") "#{@current_namespace}:#{element_name}" else element_name end if block_given? xml.element(prefixed_name, attributes) do |element| yield(self.class.new(element)) end else xml.element(prefixed_name, attributes) end @current_namespace = nil end