About EasyMorph Tutorials & Examples Web-help

QVD file metadata



Could we have an import function that extract the metadata of a QVD file like in EasyQlik QViewer ?
This would be helpful to migrate a full datastore of QVD files to another file format for storage purpose.



I would be reluctant adding a special transformation for it because it would be very rarely used.

We can try adding an option to the "Import from XML file" transformation that would stop reading file on first occurrence of zero-byte (or other character illegal in XML). That would allow reading XML headers of QVD files and extracting metadata from them.

Or maybe write a short Powershell script that would extract the XML header from a QVD file (i.e. strip the binary data), and then call it from EM before loading the XML header.

Let me give it a thought.


The option way is great. I tried to extract the XML part as a text file and then read it as an XML file but I didn't succeed to find a workaround for the double quote in the generated text file.


I've quickly made a command line utility to extract xml metadata from QVD files: QVD_Metadata.zip (4.0 KB)

Put it next to morph.exe (it needs FSharp.Core.dll).

QVD_Metadata.exe file.qvd

It creates file.xml with the metadata header.

The source code (F#):

open System.IO

let main argv = 
		if argv.Length <> 1 then
			failwith "Invalid arguments. Usage: QVD_Metadata.exe file.qvd"

		let pathQVD = argv.[0]
		let pathXML = pathQVD.Replace(".qvd", ".xml")

		use fileXML = new BinaryWriter(File.Create pathXML)

		seq {
			use fileQVD = new BinaryReader(File.Open(pathQVD, FileMode.Open, FileAccess.Read))

			// A QVD file must have a zero byte therefore the end of file will never be reached.
			while 1=1 do
				yield fileQVD.ReadByte()
		|> Seq.takeWhile (fun b -> b <> (byte 0))
		|> Seq.iter fileXML.Write

	| ex ->
		printfn "Error:%s" ex.Message


So I can consider to migrate my knowledge store out of QVD files.