lib/openwfe/expool/def_parser.rb
#
# The process definition is expressed as XML, turn that into
# an expression tree.
#
The process definition is expressed as XML, turn that into
an expression tree.
The process definition is expressed as XML turn that into an expression tree .
def parse_xml (xml)
      xml = REXML::Document.new(xml) \
        if xml.is_a?(String)
      xml = xml.root \
        if xml.is_a?(REXML::Document)
      if xml.is_a?(REXML::Text)
        s = xml.to_s.strip
        return s if s.length > 0
        return nil
      end
      return nil if xml.is_a?(REXML::Comment)
      rep = [
        xml.name,
        xml.attributes.inject({}) { |r, (k, v)| r[k] = v; r },
        [] ]
      xml.children.each do |c|
        r = parse_xml(c)
        rep.last << r if r
      end
      rep
    end
def parse_xml ( xml ) xml = REXML :: Document . new ( xml ) if xml . is_a? ( String ) xml = xml . root if xml . is_a? ( REXML :: Document ) if xml . is_a? ( REXML :: Text ) s = xml . to_s . strip return s if s . length > 0 return nil end return nil if xml . is_a? ( REXML :: Comment ) rep = [ xml . name , xml . attributes . inject ( { } ) { | r , ( k , v ) | r [ k ] = v ; r } , [ ] ] xml . children . each do | c | r = parse_xml ( c ) rep . last << r if r end rep end
The process definition is expressed as XML, turn that into
an expression tree.
The process definition is expressed as XML turn that into an expression tree .
# then it's a REXML::Element
xml
<not_specific>