module Xommelier::Xml::Element::Serialization::ClassMethods

Public Instance Methods

element_xpath(xml_doc = nil, name = nil) click to toggle source
# File lib/xommelier/xml/element/serialization.rb, line 40
def element_xpath(xml_doc = nil, name = nil)
  ns_element(xmlns_xpath(xml_doc), name || element_name)
end
from_xml(xml, options = {}) click to toggle source
# File lib/xommelier/xml/element/serialization.rb, line 27
def from_xml(xml, options = {})
  new({}, options).tap do |doc|
    doc.from_xml(xml, options)
  end
end
Also aliased as: parse, from_xommelier
from_xommelier(xml, options = {})
Alias for: from_xml
ns_element(ns, element) click to toggle source
# File lib/xommelier/xml/element/serialization.rb, line 36
def ns_element(ns, element)
  [ns, element].compact.join(':')
end
parse(xml, options = {})
Alias for: from_xml
xmlns_xpath(xml_doc = nil) click to toggle source
# File lib/xommelier/xml/element/serialization.rb, line 44
def xmlns_xpath(xml_doc = nil)
  if xml_doc
    prefix = xml_doc.namespaces.key(xmlns.try(:uri))
    (prefix =~ /:/) ? prefix[6..-1] : prefix
  else
    xmlns.as
  end
end