[vbox-dev] [External] : Re: VB xml format
klaus.espenlaub at oracle.com
Thu Nov 4 21:09:54 UTC 2021
On 2021-11-04 19:35, Stéphane Charette wrote:
> [...] First get the list of VM UUIDs with "VBoxManage list vms",
> and then get the detail information you need with "VBoxManage
> showvminfo uuid --machinereadable". The output of the latter
> should be a lot easier to process.
> The irony here (to me anyway) is that the XML file should be very easy
> to read and parse by machine. Other than having a database, file
> formats like XML and JSON are meant to be used that way.
Yes, XML is machine parseable.
However, the XML files containing the VirtualBox VM registry and the VM
configuration have by now evolved for about 17 years. Showing all kinds
of human imperfection, i.e. various forms of misdesign which survived
more or less long. The current XML parser code used in VirtualBox is
supposed to understand config files back to VirtualBox 2.0 (covering 13
If one wants to extract only very specific information (more or less
just VM names and groups) then it is probably little effort, but a
complete parser is much work (and due to our policy of upgrading the XML
representation to a newer version only if a new feature is actually used
one simply can't ignore the past).
VM groups were introduced with VirtualBox 4.2, and if one didn't
actively use them then the attribute may not be there.
If Bernard decides to go for XML parsing it could be actually much less
effort than picking the few needed bits of information from the output
of VBoxManage. At the same time efficient and a good chance to be future
proof since the attributes needed are in very stable areas of the XML.
Of course there are details to take care of (like finding VirtualBox.xml
for VirtualBox installs which existed for a long time, before it moved
to the .config/VirtualBox directory and how to interpret relative paths
for machine config files (relevant if someone kept his VM organization
from the old days when we didn't have per-VM subdirectories).
> Stéphane Charette
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vbox-dev