class Lutaml::Model::XmlAdapter::NokogiriElement

def initialize(node, root_node: nil)

def initialize(node, root_node: nil)
  if root_node
    node.namespaces.each do |prefix, name|
      namespace = XmlNamespace.new(name, prefix)
      root_node.add_namespace(namespace)
    end
  end
  attributes = {}
  node.attributes.transform_values do |attr|
    name = if attr.namespace
             "#{attr.namespace.prefix}:#{attr.name}"
           else
             attr.name
           end
    attributes[name] = XmlAttribute.new(
      name,
      attr.value,
      namespace: attr.namespace&.href,
      namespace_prefix: attr.namespace&.prefix,
    )
  end
  super(
    node.name,
    attributes,
    parse_all_children(node, root_node: root_node || self),
    node.text,
    parent_document: root_node,
    namespace_prefix: node.namespace&.prefix,
  )
end