Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert .qml (QM file) to .xml
2015-07-23. This will not work with files created with QM 2.4.0 and later.

Function QmlToXml
Copy      Help
function $qmlFile $xmlFile

;Converts .qml (QM file) to .xml.

;qmlFile - .qml file. The function does not modify it.
;xmlFile - .xml file. The function creates or replaces it.

;QM files are binary. Use this function if want to convert to text format.
;QM must be in Unicode mode.

if(!_unicode) end "QM must be in Unicode mode."

str s.getfile(qmlFile)
IXml x=CreateXml
lpstr sep="[][0][0]"

int k j=findb(s sep 4)
if(!s.beg("//QM v2.") or j<0) goto ge
IXmlNode xr=x.Add("qml")
_s.left(s j); _s.encrypt(8)
xr.Add("header" _s)
xr.SetAttributeInt("version" 1)

lpstr name triggerEtc flagsEtc folder text
,j+4; if(j=s.len) break
,triggerEtc=name+len(name)+1 ;;can contain not only trigger
,flagsEtc=triggerEtc+len(triggerEtc)+1 ;;flags[ date[ image]]
,text=strstr(folder "[]"); if(!text) goto ge
,j=findb(s sep 4 text-s+2); if(j<0) goto ge
,IXmlNode xi=xr.Add("item")
,xi.SetAttribute("name" name)
,if(triggerEtc[0]) xi.SetAttribute("triggerEtc" triggerEtc)
,xi.SetAttribute("flagsEtc" flagsEtc)
,text[0]=0; xi.SetAttribute("folder" folder)
,text[0]=13; text[-1]='.'; xi.Value=text-1 ;;.[]text[] ;;. prevents removing empty lines

;x.ToString(_s); out _s

err+ end _error
end "bad file format"

Function QmlFromXml
Copy      Help
function $qmlFile $xmlFile

;Converts .xml file created by QmlToXml back to .qml format.

;qmlFile - .qml file. The function creates or replaces it.
;xmlFile - .xml file. The function does not modify it.

;QM must be in Unicode mode.

if(!_unicode) end "QM must be in Unicode mode."

str s
IXml x=CreateXml
lpstr sep="[][0][0]"

IXmlNode xr=x.RootElement
if(xr.AttributeValueInt("version")!1) end "different version"

IXmlNode xi=xr.FirstChild
if(StrCompare(xi.Name "header")) goto ge
s.decrypt(8 xi.Value)
s.geta(sep 0 4)

,xi=xi.Next; if(!xi) break
,if(StrCompare(xi.Name "item")) goto ge
,lpstr text=xi.Value; if(text[0]='.') text+1; else goto ge ;;prevent removing empty lines
,s.fromn(s s.len xi.AttributeValue("name") -1 "" 1 xi.AttributeValue("triggerEtc") -1 "" 1 xi.AttributeValue("flagsEtc") -1 "" 1 xi.AttributeValue("folder") -1 text -1 "[0]" 2)

;outb s s.len 1

err+ end _error
end "bad file format"
needed exactly this for email backup!!

Quote:A problem occurred during the delivery of this message to this e-mail address. Try sending this message again. If the problem continues, please contact your helpdesk.

The following organization rejected your message: [].

Diagnostic information for administrators:

Generating server: mail**.******************.***

[] #<[] #5.0.0 smtp; 5.3.0 - Other mail system problem 552-'5.7.0 Our system detected an illegal attachment on your message. Please\n5.7.0 visit ... nswer=6590 to\n5.7.0 review our attachment guidelines. l5si3730312igo.4' (delivery attempts: 0)> #SMTP#
An old blog on QM coding and automation.

The Macro Hook
#3 worked once and now Google is blocking the xml and text extensions via 3rd party main programs going to gmail account. BOOOOOO...
An old blog on QM coding and automation.

The Macro Hook
Dear Gintaras,
I tried this function, but it did not work. Assuming I have a qml file: C:/source.qml and I want to convert it to C:/target.xml, how should I modify this code. Thank you in advance.
Now QM uses completely different file format. Now it is too difficult to convert to XML.
Thanks for the info.
Now QM files are SQLite databases.
Some SQLite management programs can export to XML and maybe import too. I know these, but did not try exporting/importing:
1. SQLite Expert Pro can export. The free version can't.
2. SQLite Manager can export and import. It is a Firefox addition: ... e-manager/

See also SQLite convert tools:
SQLite management tools:
And google: ... 8&oe=utf-8
thank you very much

Forum Jump:

Users browsing this thread: 1 Guest(s)