lib/lutaml/model/xml_mapping_rule.rb in lutaml-model-0.3.25 vs lib/lutaml/model/xml_mapping_rule.rb in lutaml-model-0.3.26
- old
+ new
@@ -1,11 +1,11 @@
require_relative "mapping_rule"
module Lutaml
module Model
class XmlMappingRule < MappingRule
- attr_reader :namespace, :prefix, :mixed_content, :default_namespace
+ attr_reader :namespace, :prefix, :mixed_content, :default_namespace, :cdata
def initialize(
name,
to:,
render_nil: false,
@@ -13,10 +13,11 @@
with: {},
delegate: nil,
namespace: nil,
prefix: nil,
mixed_content: false,
+ cdata: false,
namespace_set: false,
prefix_set: false,
attribute: false,
default_namespace: nil
)
@@ -36,10 +37,11 @@
else
namespace
end
@prefix = prefix
@mixed_content = mixed_content
+ @cdata = cdata
@default_namespace = default_namespace
@namespace_set = namespace_set
@prefix_set = prefix_set
@@ -57,9 +59,13 @@
name.nil?
end
def raw_mapping?
name == "__raw_mapping"
+ end
+
+ def content_key
+ cdata ? "#cdata-section" : "text"
end
def mixed_content?
!!@mixed_content
end