class Lutaml::Model::XmlAdapter::OxElement

def initialize(node, root_node: nil)

def initialize(node, root_node: nil)
  if node.is_a?(String)
    super("text", {}, [], node, parent_document: root_node)
  else
    namespace_attributes(node.attributes).each do |(name, value)|
      if root_node
        root_node.add_namespace(XmlNamespace.new(value, name))
      else
        add_namespace(XmlNamespace.new(value, name))
      end
    end
    attributes = node.attributes.each_with_object({}) do |(name, value), hash|
      next if attribute_is_namespace?(name)
      namespace_prefix = name.to_s.split(":").first
      if (n = name.to_s.split(":")).length > 1
        namespace = (root_node || self).namespaces[namespace_prefix]&.uri
        namespace ||= XML_NAMESPACE_URI
        prefix = n.first
      end
      hash[name.to_s] = XmlAttribute.new(
        name.to_s,
        value,
        namespace: namespace,
        namespace_prefix: prefix,
      )
    end
    super(
      node.name.to_s,
      attributes,
      parse_children(node, root_node: root_node || self),
      node.text,
      parent_document: root_node,
    )
  end
end