Sha256: f3ed1daa95dce4565d129fe9336e4dc4a7b760a3d3a83a0226036e9d2697d7aa

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

class Quickbooks::DtdParser < Quickbooks::QbxmlParser
  include Quickbooks::Parser::ClassBuilder

private

  def process_leaf_node(xml_obj, parent_class)
   attr_name, qb_type = parse_leaf_node_data(xml_obj)
    if parent_class
      add_casting_attribute(parent_class, attr_name, qb_type)
    end
  end

  def process_non_leaf_node(xml_obj, parent_class)
    klass = build_qbxml_class(xml_obj)
    attr_name = underscore(xml_obj)
    if parent_class
      add_strict_attribute(parent_class, attr_name, klass)
    end
    klass
  end

  #TODO: stub
  def process_comment_node(xml_obj, parent_class)
    parent_class
  end

  # helpers

  def build_qbxml_class(xml_obj)
    obj_name = xml_obj.name
    unless schema_namespace.const_defined?(obj_name)
      klass = Class.new(Quickbooks::Parser::QbxmlBase)
      schema_namespace.const_set(obj_name, klass) 
      klass.xml_attributes = parse_xml_attributes(xml_obj)
      add_xml_template(klass, xml_obj.to_xml)
    else
      klass = schema_namespace.const_get(obj_name)
    end
    klass
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
quickbooks_api-0.1.5 lib/quickbooks/dtd_parser.rb
quickbooks_api-0.1.4 lib/quickbooks/dtd_parser.rb
quickbooks_api-0.1.3 lib/quickbooks/dtd_parser.rb
quickbooks_api-0.1.2 lib/quickbooks/dtd_parser.rb
quickbooks_api-0.1.1 lib/quickbooks/dtd_parser.rb
quickbooks_api-0.1.0 lib/quickbooks/dtd_parser.rb