Answer the question
In order to leave comments, you need to log in
How to add first line to Ox (xml parser)?
It's about https://github.com/ohler55/ox . Writing
doc = Ox::Document.new(:version => '1.0', :encoding => 'UTF-8', :standalone => 'yes')
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
doc = Ox::Document.new(:version => '1.0', :encoding => 'UTF-8', :standalone => 'yes')
root = Ox::Element.new('first_el')
root[:attr1] = Time.now.to_i.to_s
doc << root
...
Ox.to_file(filepath, doc, nil)
<first_el attr1="1459522227">
...
</first_el>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
Answer the question
In order to leave comments, you need to log in
I decided by writing a line to a file directly, and not through to_file. Well, I added the required line to the line.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question