Class: CXML::Document
Instance Attribute Summary collapse
Attributes inherited from DocumentNode
#content
Instance Method Summary
collapse
accessible_attributes, accessible_nodes, attributes, #initialize, nodes, #serializable_hash, #to_element
Instance Attribute Details
#dtd ⇒ Object
32
33
34
|
# File 'lib/cxml/document.rb', line 32
def dtd
@dtd ||= 'cXML'
end
|
Instance Method Details
#dtd_url ⇒ Object
68
69
70
|
# File 'lib/cxml/document.rb', line 68
def dtd_url
"http://xml.cxml.org/schemas/cXML/#{version}/#{dtd}.dtd"
end
|
#from_xml(xml_string) ⇒ Object
54
55
56
57
|
# File 'lib/cxml/document.rb', line 54
def from_xml(xml_string)
initialize(Parser.new(data: xml_string).parse)
self
end
|
#initialize_timestamp(value) ⇒ Object
20
21
22
|
# File 'lib/cxml/document.rb', line 20
def initialize_timestamp(value)
@timestamp = Time.parse(value)
end
|
#message? ⇒ Boolean
Check if document is a message
50
51
52
|
# File 'lib/cxml/document.rb', line 50
def message?
!message.nil?
end
|
#node_name ⇒ Object
64
65
66
|
# File 'lib/cxml/document.rb', line 64
def node_name
'cXML'
end
|
#request? ⇒ Boolean
Check if document is request
38
39
40
|
# File 'lib/cxml/document.rb', line 38
def request?
!request.nil?
end
|
#response? ⇒ Boolean
Check if document is a response
44
45
46
|
# File 'lib/cxml/document.rb', line 44
def response?
!response.nil?
end
|
#timestamp ⇒ Object
24
25
26
|
# File 'lib/cxml/document.rb', line 24
def timestamp
@timestamp ||= Time.now.utc
end
|
#to_xml(doc = ox_doc) ⇒ Object
59
60
61
62
|
# File 'lib/cxml/document.rb', line 59
def to_xml(doc = ox_doc)
doc << to_element
Ox.dump doc
end
|
#version ⇒ Object
28
29
30
|
# File 'lib/cxml/document.rb', line 28
def version
@version ||= '1.2.037'
end
|