Class: Rubyang::Database::DataTree::Anyxml

Inherits:
Node
  • Object
show all
Defined in:
lib/rubyang/database/data_tree.rb

Instance Attribute Summary

Attributes inherited from Node

#children, #parent, #schema, #schema_tree

Instance Method Summary collapse

Methods inherited from Node

#evaluate_max_elements, #evaluate_min_elements, #evaluate_musts, #evaluate_whens, #evaluate_xpath, #evaluate_xpath_axis, #evaluate_xpath_expr, #evaluate_xpath_node_test, #evaluate_xpath_path, #evaluate_xpath_predicates, #initialize, #load_merge_xml_recursive, #root, #to_json, #to_s, #to_xml, #valid?

Constructor Details

This class inherits a constructor from Rubyang::Database::DataTree::Node

Instance Method Details

#set(arg) ⇒ Object



936
937
938
# File 'lib/rubyang/database/data_tree.rb', line 936

def set arg
  @value = REXML::Document.new( arg )
end

#to_json_recursive(_hash) ⇒ Object



949
950
951
952
953
# File 'lib/rubyang/database/data_tree.rb', line 949

def to_json_recursive _hash
  raise "anyxml to json is not implemented"
  hash = _hash
  hash[@schema.model.arg] = @value.to_s
end

#to_xml_recursive(_doc, current_namespace) ⇒ Object



942
943
944
945
946
947
948
# File 'lib/rubyang/database/data_tree.rb', line 942

def to_xml_recursive _doc, current_namespace
  doc = _doc.add_element @value
  unless @schema.namespace == current_namespace
    current_namespace = @schema.namespace
    doc.add_namespace current_namespace
  end
end

#valueObject



939
940
941
# File 'lib/rubyang/database/data_tree.rb', line 939

def value
  @value.to_s
end