Okey, this is temporary partial solution.
----------------------------------
require 'active_support/all'
resultMap = {
Task: {
fields: ["id", "subject", "project", "context", "today", "start", "due", "complete",
"tags", "reminder", "logged", "repeat", "repeated", "method", "interval",
"completion", "modified", "priority", "syncid", "notes", "dirty", "deleted",
"calid", "star", "viewed", "parent", "completedon"],
predefined: %w(calid logged)
},
Project: {
fields: ["id", "parent", "name", "due", "context", "complete", "tags", "pinned",
"syncid", "modified", "dirty", "deleted"],
predefined: %w(pinned)
},
Context: {
fields: ["id", "name", "lattitude", "longitude", "syncid", "modified", "data",
"method", "dirty", "deleted"],
predefined: %w()
},
Tag: {
fields: ["id", "name", "syncid", "modified", "dirty", "deleted"],
predefined: %w()
},
}
result = ''
backup = Hash.from_xml('<root>%s</root>' % STDIN.read)['root']
resultMap.each { |element, attributes|
backup[element.to_s].each { |item|
text = attributes[:fields].map { |attribute|
value = attributes[:predefined].include?(attribute) ? '0' : item[attribute]
'%s="%s"' % [attribute, value]
}.join(" ")
result += "<%s %s/>\n" % [element.to_s, text]
}
}
print result
----------------------------------
>> ruby convert.rb < windows_backup.txt > backup.txt
----------------------------------
Looks like android version of Due Today is sensitive to the order of attirbutes in this 'xml' file. So, xml autogenerators is hard to use.
I hope that 'direct sync' feature between windows and phone verisons will be added soon. Clouds like toddledo are good, but not a cure-all solution.