Module: Xmi::ParserPipeline::Steps::RenameEaXmlnsAttribute

Defined in:
lib/xmi/parser_pipeline.rb

Overview

EA misuses the reserved xmlns attribute as a DATA attribute on GML:/CityGML:ApplicationSchema stereotype elements (values unrelated to real namespace declarations). XML parsers treat xmlns as a namespace declaration, so without renaming, the value is silently dropped. Restored from the original replace_ea_xmlns preprocessing (commit 8da3bfb), which was lost in the lutaml-model 0.8 upgrade.

Constant Summary collapse

EA_XMLNS_TAG =
%r{(<(?:GML|CityGML):ApplicationSchema[^>]*?)xmlns="([^"]*)"}

Class Method Summary collapse

Class Method Details

.call(ctx) ⇒ Object



39
40
41
42
# File 'lib/xmi/parser_pipeline.rb', line 39

def self.call(ctx)
  ctx[:xml] = ctx[:xml].gsub(EA_XMLNS_TAG, '\1altered_xmlns="\2"')
  ctx
end