lutaml-model 0.8.4 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/dependent-tests.yml +5 -0
- data/.rubocop.yml +18 -0
- data/.rubocop_todo.yml +91 -22
- data/Gemfile +2 -0
- data/README.adoc +114 -2
- data/docs/_guides/index.adoc +18 -0
- data/docs/_guides/jsonld-serialization.adoc +217 -0
- data/docs/_guides/rdf-serialization.adoc +344 -0
- data/docs/_guides/turtle-serialization.adoc +224 -0
- data/docs/_migrations/0-8-0-namespace-restructuring.adoc +90 -0
- data/docs/_pages/serialization_adapters.adoc +31 -0
- data/docs/_references/index.adoc +1 -0
- data/docs/_references/rdf-namespaces.adoc +243 -0
- data/docs/index.adoc +3 -2
- data/lib/lutaml/jsonld/adapter.rb +23 -0
- data/lib/lutaml/jsonld/context.rb +69 -0
- data/lib/lutaml/jsonld/term_definition.rb +39 -0
- data/lib/lutaml/jsonld/transform.rb +174 -0
- data/lib/lutaml/jsonld.rb +23 -0
- data/lib/lutaml/model/format_registry.rb +10 -1
- data/lib/lutaml/model/serialize/format_conversion.rb +17 -1
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/model.rb +6 -0
- data/lib/lutaml/rdf/error.rb +7 -0
- data/lib/lutaml/rdf/iri.rb +44 -0
- data/lib/lutaml/rdf/language_tagged.rb +11 -0
- data/lib/lutaml/rdf/literal.rb +62 -0
- data/lib/lutaml/rdf/mapping.rb +71 -0
- data/lib/lutaml/rdf/mapping_rule.rb +35 -0
- data/lib/lutaml/rdf/member_rule.rb +13 -0
- data/lib/lutaml/rdf/namespace.rb +58 -0
- data/lib/lutaml/rdf/namespace_set.rb +69 -0
- data/lib/lutaml/rdf/namespaces/dcterms_namespace.rb +12 -0
- data/lib/lutaml/rdf/namespaces/owl_namespace.rb +12 -0
- data/lib/lutaml/rdf/namespaces/rdf_namespace.rb +14 -0
- data/lib/lutaml/rdf/namespaces/rdfs_namespace.rb +12 -0
- data/lib/lutaml/rdf/namespaces/skos_namespace.rb +12 -0
- data/lib/lutaml/rdf/namespaces/xsd_namespace.rb +12 -0
- data/lib/lutaml/rdf/namespaces.rb +14 -0
- data/lib/lutaml/rdf/transform.rb +36 -0
- data/lib/lutaml/rdf.rb +19 -0
- data/lib/lutaml/turtle/adapter.rb +35 -0
- data/lib/lutaml/turtle/mapping.rb +7 -0
- data/lib/lutaml/turtle/transform.rb +158 -0
- data/lib/lutaml/turtle.rb +22 -0
- data/lib/lutaml/xml/adapter/adapter_helpers.rb +1 -42
- data/lib/lutaml/xml/adapter/base_adapter.rb +48 -458
- data/lib/lutaml/xml/adapter/namespace_data.rb +0 -17
- data/lib/lutaml/xml/adapter/namespace_uri_collector.rb +71 -0
- data/lib/lutaml/xml/adapter/nokogiri_adapter.rb +5 -1110
- data/lib/lutaml/xml/adapter/oga_adapter.rb +6 -846
- data/lib/lutaml/xml/adapter/ox_adapter.rb +7 -884
- data/lib/lutaml/xml/adapter/plan_based_builder.rb +929 -0
- data/lib/lutaml/xml/adapter/rexml_adapter.rb +10 -864
- data/lib/lutaml/xml/adapter/xml_parser.rb +86 -0
- data/lib/lutaml/xml/adapter/xml_serializer.rb +291 -0
- data/lib/lutaml/xml/adapter.rb +0 -1
- data/lib/lutaml/xml/adapter_element.rb +7 -1
- data/lib/lutaml/xml/builder/base.rb +0 -1
- data/lib/lutaml/xml/data_model.rb +9 -1
- data/lib/lutaml/xml/document.rb +3 -1
- data/lib/lutaml/xml/element.rb +13 -10
- data/lib/lutaml/xml/serialization/format_conversion.rb +19 -42
- data/lib/lutaml/xml/serialization/instance_methods.rb +26 -35
- data/lib/lutaml/xml/transformation/custom_method_wrapper.rb +34 -55
- data/lib/lutaml/xml/transformation/rule_applier.rb +1 -1
- data/lib/lutaml/xml/xml_element.rb +24 -20
- data/spec/lutaml/integration/edge_cases_spec.rb +109 -0
- data/spec/lutaml/integration/multi_format_spec.rb +106 -0
- data/spec/lutaml/integration/round_trip_spec.rb +170 -0
- data/spec/lutaml/jsonld/adapter_spec.rb +46 -0
- data/spec/lutaml/jsonld/context_spec.rb +114 -0
- data/spec/lutaml/jsonld/term_definition_spec.rb +55 -0
- data/spec/lutaml/jsonld/transform_spec.rb +211 -0
- data/spec/lutaml/rdf/graph_serialization_spec.rb +137 -0
- data/spec/lutaml/rdf/iri_spec.rb +73 -0
- data/spec/lutaml/rdf/literal_spec.rb +98 -0
- data/spec/lutaml/rdf/mapping_spec.rb +164 -0
- data/spec/lutaml/rdf/member_rule_spec.rb +17 -0
- data/spec/lutaml/rdf/namespace_set_spec.rb +115 -0
- data/spec/lutaml/rdf/namespace_spec.rb +241 -0
- data/spec/lutaml/rdf/rdf_transform_spec.rb +82 -0
- data/spec/lutaml/turtle/adapter_spec.rb +47 -0
- data/spec/lutaml/turtle/mapping_spec.rb +123 -0
- data/spec/lutaml/turtle/transform_spec.rb +273 -0
- data/spec/lutaml/xml/adapter/base_adapter_regression_spec.rb +151 -0
- data/spec/lutaml/xml/adapter/order_spec.rb +150 -0
- data/spec/lutaml/xml/clear_parse_state_spec.rb +139 -0
- data/spec/lutaml/xml/doubly_defined_namespace_spec.rb +0 -2
- data/spec/lutaml/xml/schema/compiler_spec.rb +75 -69
- data/spec/lutaml/xml/transformation/custom_method_wrapper_spec.rb +213 -14
- metadata +58 -3
- data/lib/lutaml/xml/adapter/xml_serialization.rb +0 -145
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lutaml-model
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05-
|
|
11
|
+
date: 2026-05-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -198,12 +198,15 @@ files:
|
|
|
198
198
|
- docs/_guides/creating-xsd.adoc
|
|
199
199
|
- docs/_guides/document-validation.adoc
|
|
200
200
|
- docs/_guides/index.adoc
|
|
201
|
+
- docs/_guides/jsonld-serialization.adoc
|
|
201
202
|
- docs/_guides/keyvalue-serialization.adoc
|
|
202
203
|
- docs/_guides/liquid-templates.adoc
|
|
203
204
|
- docs/_guides/missing-values-handling.adoc
|
|
204
205
|
- docs/_guides/ooxml-examples.adoc
|
|
206
|
+
- docs/_guides/rdf-serialization.adoc
|
|
205
207
|
- docs/_guides/schema-generation.adoc
|
|
206
208
|
- docs/_guides/schema-import.adoc
|
|
209
|
+
- docs/_guides/turtle-serialization.adoc
|
|
207
210
|
- docs/_guides/value-transformations.adoc
|
|
208
211
|
- docs/_guides/xml-mapping.adoc
|
|
209
212
|
- docs/_guides/xml-mappings-guide.adoc
|
|
@@ -253,6 +256,7 @@ files:
|
|
|
253
256
|
- docs/_references/instance-serialization.adoc
|
|
254
257
|
- docs/_references/lutaml-namespace-planning.md
|
|
255
258
|
- docs/_references/parent-root-context.adoc
|
|
259
|
+
- docs/_references/rdf-namespaces.adoc
|
|
256
260
|
- docs/_references/reference_type.adoc
|
|
257
261
|
- docs/_references/serialization-model-mappings.adoc
|
|
258
262
|
- docs/_references/three-phase-namespace-architecture.adoc
|
|
@@ -313,6 +317,11 @@ files:
|
|
|
313
317
|
- lib/lutaml/jsonl/adapter/mapping_rule.rb
|
|
314
318
|
- lib/lutaml/jsonl/adapter/standard_adapter.rb
|
|
315
319
|
- lib/lutaml/jsonl/adapter/transform.rb
|
|
320
|
+
- lib/lutaml/jsonld.rb
|
|
321
|
+
- lib/lutaml/jsonld/adapter.rb
|
|
322
|
+
- lib/lutaml/jsonld/context.rb
|
|
323
|
+
- lib/lutaml/jsonld/term_definition.rb
|
|
324
|
+
- lib/lutaml/jsonld/transform.rb
|
|
316
325
|
- lib/lutaml/key_value.rb
|
|
317
326
|
- lib/lutaml/key_value/adapter.rb
|
|
318
327
|
- lib/lutaml/key_value/adapter/hash.rb
|
|
@@ -589,6 +598,24 @@ files:
|
|
|
589
598
|
- lib/lutaml/model/version.rb
|
|
590
599
|
- lib/lutaml/model/yaml.rb
|
|
591
600
|
- lib/lutaml/model/yamls.rb
|
|
601
|
+
- lib/lutaml/rdf.rb
|
|
602
|
+
- lib/lutaml/rdf/error.rb
|
|
603
|
+
- lib/lutaml/rdf/iri.rb
|
|
604
|
+
- lib/lutaml/rdf/language_tagged.rb
|
|
605
|
+
- lib/lutaml/rdf/literal.rb
|
|
606
|
+
- lib/lutaml/rdf/mapping.rb
|
|
607
|
+
- lib/lutaml/rdf/mapping_rule.rb
|
|
608
|
+
- lib/lutaml/rdf/member_rule.rb
|
|
609
|
+
- lib/lutaml/rdf/namespace.rb
|
|
610
|
+
- lib/lutaml/rdf/namespace_set.rb
|
|
611
|
+
- lib/lutaml/rdf/namespaces.rb
|
|
612
|
+
- lib/lutaml/rdf/namespaces/dcterms_namespace.rb
|
|
613
|
+
- lib/lutaml/rdf/namespaces/owl_namespace.rb
|
|
614
|
+
- lib/lutaml/rdf/namespaces/rdf_namespace.rb
|
|
615
|
+
- lib/lutaml/rdf/namespaces/rdfs_namespace.rb
|
|
616
|
+
- lib/lutaml/rdf/namespaces/skos_namespace.rb
|
|
617
|
+
- lib/lutaml/rdf/namespaces/xsd_namespace.rb
|
|
618
|
+
- lib/lutaml/rdf/transform.rb
|
|
592
619
|
- lib/lutaml/toml.rb
|
|
593
620
|
- lib/lutaml/toml/adapter.rb
|
|
594
621
|
- lib/lutaml/toml/adapter/document.rb
|
|
@@ -598,16 +625,23 @@ files:
|
|
|
598
625
|
- lib/lutaml/toml/adapter/tomlib_adapter.rb
|
|
599
626
|
- lib/lutaml/toml/adapter/transform.rb
|
|
600
627
|
- lib/lutaml/toml/type/serializers.rb
|
|
628
|
+
- lib/lutaml/turtle.rb
|
|
629
|
+
- lib/lutaml/turtle/adapter.rb
|
|
630
|
+
- lib/lutaml/turtle/mapping.rb
|
|
631
|
+
- lib/lutaml/turtle/transform.rb
|
|
601
632
|
- lib/lutaml/xml.rb
|
|
602
633
|
- lib/lutaml/xml/adapter.rb
|
|
603
634
|
- lib/lutaml/xml/adapter/adapter_helpers.rb
|
|
604
635
|
- lib/lutaml/xml/adapter/base_adapter.rb
|
|
605
636
|
- lib/lutaml/xml/adapter/namespace_data.rb
|
|
637
|
+
- lib/lutaml/xml/adapter/namespace_uri_collector.rb
|
|
606
638
|
- lib/lutaml/xml/adapter/nokogiri_adapter.rb
|
|
607
639
|
- lib/lutaml/xml/adapter/oga_adapter.rb
|
|
608
640
|
- lib/lutaml/xml/adapter/ox_adapter.rb
|
|
641
|
+
- lib/lutaml/xml/adapter/plan_based_builder.rb
|
|
609
642
|
- lib/lutaml/xml/adapter/rexml_adapter.rb
|
|
610
|
-
- lib/lutaml/xml/adapter/
|
|
643
|
+
- lib/lutaml/xml/adapter/xml_parser.rb
|
|
644
|
+
- lib/lutaml/xml/adapter/xml_serializer.rb
|
|
611
645
|
- lib/lutaml/xml/adapter_element.rb
|
|
612
646
|
- lib/lutaml/xml/adapter_loader.rb
|
|
613
647
|
- lib/lutaml/xml/attribute_namespace_resolver.rb
|
|
@@ -1513,6 +1547,13 @@ files:
|
|
|
1513
1547
|
- spec/fixtures/xml/user.xsd
|
|
1514
1548
|
- spec/fixtures/xml/valid_math_document.xml
|
|
1515
1549
|
- spec/fixtures/yamls_range_concept.rb
|
|
1550
|
+
- spec/lutaml/integration/edge_cases_spec.rb
|
|
1551
|
+
- spec/lutaml/integration/multi_format_spec.rb
|
|
1552
|
+
- spec/lutaml/integration/round_trip_spec.rb
|
|
1553
|
+
- spec/lutaml/jsonld/adapter_spec.rb
|
|
1554
|
+
- spec/lutaml/jsonld/context_spec.rb
|
|
1555
|
+
- spec/lutaml/jsonld/term_definition_spec.rb
|
|
1556
|
+
- spec/lutaml/jsonld/transform_spec.rb
|
|
1516
1557
|
- spec/lutaml/key_value/transformation/collection_serializer_spec.rb
|
|
1517
1558
|
- spec/lutaml/key_value/transformation/rule_compiler_spec.rb
|
|
1518
1559
|
- spec/lutaml/key_value/transformation/value_serializer_spec.rb
|
|
@@ -1658,12 +1699,26 @@ files:
|
|
|
1658
1699
|
- spec/lutaml/model/yamls_sequence_spec.rb
|
|
1659
1700
|
- spec/lutaml/model/yamls_spec.rb
|
|
1660
1701
|
- spec/lutaml/model_spec.rb
|
|
1702
|
+
- spec/lutaml/rdf/graph_serialization_spec.rb
|
|
1703
|
+
- spec/lutaml/rdf/iri_spec.rb
|
|
1704
|
+
- spec/lutaml/rdf/literal_spec.rb
|
|
1705
|
+
- spec/lutaml/rdf/mapping_spec.rb
|
|
1706
|
+
- spec/lutaml/rdf/member_rule_spec.rb
|
|
1707
|
+
- spec/lutaml/rdf/namespace_set_spec.rb
|
|
1708
|
+
- spec/lutaml/rdf/namespace_spec.rb
|
|
1709
|
+
- spec/lutaml/rdf/rdf_transform_spec.rb
|
|
1710
|
+
- spec/lutaml/turtle/adapter_spec.rb
|
|
1711
|
+
- spec/lutaml/turtle/mapping_spec.rb
|
|
1712
|
+
- spec/lutaml/turtle/transform_spec.rb
|
|
1713
|
+
- spec/lutaml/xml/adapter/base_adapter_regression_spec.rb
|
|
1661
1714
|
- spec/lutaml/xml/adapter/nokogiri_adapter_spec.rb
|
|
1662
1715
|
- spec/lutaml/xml/adapter/oga_adapter_spec.rb
|
|
1716
|
+
- spec/lutaml/xml/adapter/order_spec.rb
|
|
1663
1717
|
- spec/lutaml/xml/adapter/ox_adapter_spec.rb
|
|
1664
1718
|
- spec/lutaml/xml/adapter/rexml_adapter_spec.rb
|
|
1665
1719
|
- spec/lutaml/xml/adapter/xml_namespace_spec.rb
|
|
1666
1720
|
- spec/lutaml/xml/builder/builder_spec.rb
|
|
1721
|
+
- spec/lutaml/xml/clear_parse_state_spec.rb
|
|
1667
1722
|
- spec/lutaml/xml/compiled_rule_namespace_spec.rb
|
|
1668
1723
|
- spec/lutaml/xml/conformance/xml_namespaces_spec.rb
|
|
1669
1724
|
- spec/lutaml/xml/conformance/xml_schema_instance_spec.rb
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Lutaml
|
|
4
|
-
module Xml
|
|
5
|
-
module Adapter
|
|
6
|
-
# Shared XML serialization logic for all adapters
|
|
7
|
-
#
|
|
8
|
-
# This module provides the common three-phase XML serialization architecture:
|
|
9
|
-
# 1. Collect namespace needs from XmlElement tree
|
|
10
|
-
# 2. Plan namespace declarations with hoisting
|
|
11
|
-
# 3. Render using parallel traversal (XmlElement + DeclarationPlan)
|
|
12
|
-
#
|
|
13
|
-
# All adapters follow the same pattern:
|
|
14
|
-
# - Case A: Parsed element (adapter-specific) → build_xml
|
|
15
|
-
# - Case B: XmlElement → build_xml_element_with_plan
|
|
16
|
-
# - Case C: Model instance → transform to XmlElement OR legacy path
|
|
17
|
-
#
|
|
18
|
-
# @example Include in adapter
|
|
19
|
-
# class NokogiriAdapter < BaseAdapter
|
|
20
|
-
# include XmlSerialization
|
|
21
|
-
#
|
|
22
|
-
# private
|
|
23
|
-
#
|
|
24
|
-
# def build_xml_element_with_plan(xml, xml_element, plan, options)
|
|
25
|
-
# # Adapter-specific implementation
|
|
26
|
-
# end
|
|
27
|
-
# end
|
|
28
|
-
module XmlSerialization
|
|
29
|
-
# Serialize to XML using three-phase architecture
|
|
30
|
-
#
|
|
31
|
-
# @param options [Hash] Serialization options
|
|
32
|
-
# @option options [Class] :mapper_class Model class for mapping lookup
|
|
33
|
-
# @option options [String] :encoding Character encoding
|
|
34
|
-
# @option options [Boolean] :declaration Include XML declaration
|
|
35
|
-
# @option options [Boolean] :pretty Pretty-print output
|
|
36
|
-
# @return [String] XML document
|
|
37
|
-
def to_xml(options = {})
|
|
38
|
-
# Accept xml_declaration from options if present (for model serialization)
|
|
39
|
-
@xml_declaration = options[:xml_declaration] if options[:xml_declaration]
|
|
40
|
-
|
|
41
|
-
# Build XML using adapter-specific builder
|
|
42
|
-
build_xml_document(options)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
private
|
|
46
|
-
|
|
47
|
-
# Build the XML document (template method)
|
|
48
|
-
#
|
|
49
|
-
# Override in adapter to use specific builder
|
|
50
|
-
#
|
|
51
|
-
# @param options [Hash] Serialization options
|
|
52
|
-
# @return [String] XML document
|
|
53
|
-
def build_xml_document(options)
|
|
54
|
-
raise NotImplementedError,
|
|
55
|
-
"Subclasses must implement #build_xml_document"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# Transform model instance to XmlElement tree
|
|
59
|
-
#
|
|
60
|
-
# @param model [Object] Model instance
|
|
61
|
-
# @param mapper_class [Class] Model class
|
|
62
|
-
# @param options [Hash] Serialization options
|
|
63
|
-
# @return [XmlDataModel::XmlElement] Transformed element tree
|
|
64
|
-
def transform_model_to_xml_element(model, mapper_class, options)
|
|
65
|
-
transformation = mapper_class.transformation_for(:xml, register)
|
|
66
|
-
transformation.transform(model, options)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
# Check if model has custom map_all methods
|
|
70
|
-
#
|
|
71
|
-
# @param xml_mapping [Xml::Mapping] XML mapping
|
|
72
|
-
# @return [Boolean] True if custom methods present
|
|
73
|
-
def has_custom_map_all_methods?(xml_mapping)
|
|
74
|
-
xml_mapping.raw_mapping&.custom_methods &&
|
|
75
|
-
xml_mapping.raw_mapping.custom_methods[:to]
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
# Collect namespace needs from element
|
|
79
|
-
#
|
|
80
|
-
# @param element [XmlElement, Object] Element to collect from
|
|
81
|
-
# @param mapping [Xml::Mapping] XML mapping
|
|
82
|
-
# @param mapper_class [Class] Model class
|
|
83
|
-
# @return [Hash] Namespace needs
|
|
84
|
-
def collect_namespace_needs(element, mapping, mapper_class: nil)
|
|
85
|
-
collector = NamespaceCollector.new(register)
|
|
86
|
-
collector.collect(element, mapping, mapper_class: mapper_class)
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
# Plan namespace declarations
|
|
90
|
-
#
|
|
91
|
-
# @param element [XmlElement, Object] Element to plan for
|
|
92
|
-
# @param mapping [Xml::Mapping] XML mapping
|
|
93
|
-
# @param needs [Hash] Namespace needs
|
|
94
|
-
# @param options [Hash] Serialization options
|
|
95
|
-
# @return [DeclarationPlan] Declaration plan with tree structure
|
|
96
|
-
def plan_namespace_declarations(element, mapping, needs, options: {})
|
|
97
|
-
planner = DeclarationPlanner.new(register)
|
|
98
|
-
planner.plan(element, mapping, needs, options: options)
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
# Determine encoding from options
|
|
102
|
-
#
|
|
103
|
-
# @param options [Hash] Options hash
|
|
104
|
-
# @return [String, nil] Encoding string or nil
|
|
105
|
-
def determine_encoding(options)
|
|
106
|
-
options[:encoding] ||
|
|
107
|
-
options[:parse_encoding] ||
|
|
108
|
-
@encoding ||
|
|
109
|
-
"UTF-8"
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
# Check if XML declaration should be included
|
|
113
|
-
#
|
|
114
|
-
# @param options [Hash] Options hash
|
|
115
|
-
# @return [Boolean] True if declaration should be included
|
|
116
|
-
def should_include_declaration?(options)
|
|
117
|
-
options[:declaration] == true
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
# Generate final XML output with declaration and doctype
|
|
121
|
-
#
|
|
122
|
-
# @param xml_data [String] XML content
|
|
123
|
-
# @param options [Hash] Serialization options
|
|
124
|
-
# @return [String] Complete XML document
|
|
125
|
-
def finalize_xml_output(xml_data, options)
|
|
126
|
-
result = ""
|
|
127
|
-
|
|
128
|
-
# Include declaration when encoding is specified OR when declaration is requested
|
|
129
|
-
if (options[:encoding] && !options[:encoding].nil?) || should_include_declaration?(options)
|
|
130
|
-
result += generate_declaration(options)
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
# Add DOCTYPE if present
|
|
134
|
-
doctype_to_use = options[:doctype] || @doctype
|
|
135
|
-
if doctype_to_use && !options[:omit_doctype]
|
|
136
|
-
result += generate_doctype_declaration(doctype_to_use)
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
result += xml_data
|
|
140
|
-
result
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
end
|
|
145
|
-
end
|