Class: Uniword::Wordprocessingml::Settings
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Uniword::Wordprocessingml::Settings
- Defined in:
- lib/uniword/wordprocessingml/settings.rb
Overview
Document settings
Generated from OOXML schema: wordprocessingml.yml Element: <w:settings>
Class Method Summary collapse
-
.from_xml(xml_content) ⇒ Object
Override from_xml to manually deserialize w15:docId which has the same element name as w14:docId and can’t be distinguished by map_element alone.
Class Method Details
.from_xml(xml_content) ⇒ Object
Override from_xml to manually deserialize w15:docId which has the same element name as w14:docId and can’t be distinguished by map_element alone. Note: Both docId elements have their values captured via map_element (w14) and from_xml (w15). The w15:docId’s GUID is preserved in the model.
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
# File 'lib/uniword/wordprocessingml/settings.rb', line 623 def self.from_xml(xml_content) settings = super doc = Nokogiri::XML(xml_content) doc_ids = doc.xpath('//*[local-name()="docId"]') doc_ids.each do |elem| ns_uri = elem.namespace&.href val = elem.attributes["val"]&.value next unless val if (ns_uri == "http://schemas.microsoft.com/office/word/2012/wordml") && !settings.w15_doc_id&.val # w15:docId - manually deserialize since map_element captures w14:docId settings.w15_doc_id = W15DocId.new(val: val) end # w14:docId is captured by map_element 'docId', no action needed end settings end |