Class: OpenehrRails::Opt::Parser
- Inherits:
-
OpenEHR::Parser::OPTParser
- Object
- OpenEHR::Parser::OPTParser
- OpenehrRails::Opt::Parser
- Defined in:
- lib/openehr_rails/opt/parser.rb
Overview
OPT parser accepting raw OPT XML content, not just a file path.
OpenEHR::Parser::OPTParser#parse unconditionally does File.open(@filename); callers here (TemplateUploader, TemplateRegistry, Fhir::ProfileRepository) need to parse XML already held in memory, so #parse is overridden with that as the only change — uid/occurrences tolerance now lives upstream.
Constant Summary collapse
- UTF8_BOM =
"\xEF\xBB\xBF".freeze
Instance Method Summary collapse
Instance Method Details
#parse ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/openehr_rails/opt/parser.rb', line 14 def parse source = if raw_xml_content?(@filename) @filename # raw OPT XML content else File.open(@filename) end @opt = Nokogiri::XML::Document.parse(source) @opt.remove_namespaces! defs = definition OpenEHR::AM::Template::OperationalTemplate.new( uid: build_uid, concept: concept, original_language: language, description: description, template_id: template_id, archetype_id: template_id, definition: defs, ontology: (@component_terminologies || {})[defs.archetype_id.value] || create_template_ontology, component_terminologies: @component_terminologies || {}, terminology_extracts: @component_terminologies || {}, adl_version: '1.4' ) end |