lutaml / lutaml-model

LutaML Model is the Ruby data modeler part of the LutaML data modeling suite. It supports creating serialization object models (XML, YAML, JSON, TOML) and mappings to and from them.
Other
2 stars 2 forks source link

Handling raw HTML as field values in XML formats #106

Open ronaldtse opened 1 month ago

ronaldtse commented 1 month ago

We've just come across an example of embedding raw HTML inside XML.

The NIST OSCAL Metaschema allows embedding HTML inside XML as documentation.

This is the exact use case for using the raw option for an attribute.

From:

@HassanAkbar can we confirm that this use case is supported by raw? Thanks!

HassanAkbar commented 1 month ago

@ronaldtse Currently, we can use the raw tag for this by adding it to each attribute we define, like attribute:remarks, raw: true, but for the current implementation, we will have to define raw: true everywhere. We can have something like as discussed here https://github.com/lutaml/lutaml-model/issues/57#issuecomment-2379211692, or we can provide raw: true at root level for an attribute like

class Remark < Lutaml::Model::Serializeable
  attribute :raw_content

  xml do
    root "remarks", raw: true

    map_content to: :raw_content
  end
end

@ronaldtse What do you suggest?

ronaldtse commented 1 week ago

@HassanAkbar now that #129 is merged, do we still need this ticket? Thanks.

HassanAkbar commented 1 day ago

@ronaldtse I think this is no longer needed as we have both the raw tag and map_all.