Module: DcmDict::XML::NokogiriTool
- Defined in:
- lib/dcm_dict/xml/nokogiri_tool.rb
Class Method Summary collapse
-
.create_xml_doc(xml_string) ⇒ Object
Create XML root object from xml source string
xml_string
. -
.each_tr_set(doc, xpath) ⇒ Object
Calls the given block from
doc
once for each ‘table row’ identified byxpath
. -
.extract_data_element_field_from_tr_set(trset) ⇒ Object
Extract data element data from xml table row using
trset
(NodeSet) as source. -
.extract_data_element_field_from_xml_tr(xml_tr_string) ⇒ Object
Extract data element data from a table row using
xml_tr_string
as source string. -
.extract_uid_field_from_tr_set(trset) ⇒ Object
Extract uid data from a table row using
trset
(NodeSet) as source. -
.extract_uid_field_from_xml_tr(xml_tr_string) ⇒ Object
Extract uid data from a table row using
xml_tr_string
as source string.
Class Method Details
.create_xml_doc(xml_string) ⇒ Object
Create XML root object from xml source string xml_string
69 70 71 |
# File 'lib/dcm_dict/xml/nokogiri_tool.rb', line 69 def self.create_xml_doc(xml_string) Nokogiri::XML(xml_string) end |
.each_tr_set(doc, xpath) ⇒ Object
Calls the given block from doc
once for each ‘table row’ identified by xpath
74 75 76 77 78 79 80 |
# File 'lib/dcm_dict/xml/nokogiri_tool.rb', line 74 def self.each_tr_set(doc, xpath) alltr = doc.xpath(xpath) alltr.each do |tr| trset = tr.xpath('xmlns:td') yield trset if block_given? end end |
.extract_data_element_field_from_tr_set(trset) ⇒ Object
Extract data element data from xml table row using trset
(NodeSet) as source
51 52 53 54 |
# File 'lib/dcm_dict/xml/nokogiri_tool.rb', line 51 def self.extract_data_element_field_from_tr_set(trset) proc = tag_field_extract_proc(trset) TagFieldData.new(proc).data_element_data end |
.extract_data_element_field_from_xml_tr(xml_tr_string) ⇒ Object
Extract data element data from a table row using xml_tr_string
as source string
45 46 47 48 |
# File 'lib/dcm_dict/xml/nokogiri_tool.rb', line 45 def self.extract_data_element_field_from_xml_tr(xml_tr_string) nodeset = extract_nokogiri_nodeset(xml_tr_string) extract_data_element_field_from_tr_set(nodeset) end |
.extract_uid_field_from_tr_set(trset) ⇒ Object
Extract uid data from a table row using trset
(NodeSet) as source
63 64 65 66 |
# File 'lib/dcm_dict/xml/nokogiri_tool.rb', line 63 def self.extract_uid_field_from_tr_set(trset) proc = uid_field_extract_proc(trset) UidFieldData.new(proc).uid_data end |
.extract_uid_field_from_xml_tr(xml_tr_string) ⇒ Object
Extract uid data from a table row using xml_tr_string
as source string
57 58 59 60 |
# File 'lib/dcm_dict/xml/nokogiri_tool.rb', line 57 def self.extract_uid_field_from_xml_tr(xml_tr_string) nodeset = extract_nokogiri_nodeset(xml_tr_string) extract_uid_field_from_tr_set(nodeset) end |