Does Gramps retain the ability to directly read & write XML (as it did in Gramps 1.0)?

Before BSDDB was added as the database engine for Gramps 2.0.0 in May of 2005, Gramps directly wrote to an XML file.

Does this ability still exist as a legacy feature? Can Gramps read from (or write to) an external file while having a different Tree loaded in the Database Engine?

As I remember, the database was only in memory and the only way to save it was to write the xml file like an export.

You might say that the import and merge feature does that.

But then my next question is, why did you ask?

There are some things that Gramps does now with hard coded sample data in Python. So it takes coding skills to tweak. But if they were in .gramps XML files, it opens opportunities for non-programmers (such as people with degrees in Education or data modeling) to make for baseline data for special tools and tutorials.

I’d also like to see some examples of Gramps reading & writing reference files.

There is already a strong need for a Gramplet that displays GitHub markdown content (but does not have edit capability although allowing highlight, copy & click). Thats because we already have a huge library of Gramps content waiting to be seen.

The README.md files located in the same folder as the .gpr.py registration file are Help features that only adept user know to look for. (And they allow illustrations that our internal Note format cannot show.) They could be made accessible through the interface. (There are Python libraries for GitHub markdown display.)

OK, yes, I hoped that you’d write that. :slight_smile:

If you have .gramps backups, which are saved after every session, this is quite easy to realize outside Gramps, although a bit of automation would help to make it even faster. I have a C# program that just loads a .gramps file, runs gzip to extract it when needed, and then loads the XML tree, so that I can use all sorts of fancy queries on it, either by looping through all XML nodes of a particular type, or by using specialized Xpath queries, and these tricks are way fater in C# (with .NET) than in Gramps. And our PC’s are big enough to handle this. I even use this for tweaks, because for me it’s way more transparent then using Isotammi tools.

Anyway, if you accept that you can’t open database files, but need to work on .gramps files, it is quite easy for data scientists too, once you know how to extract the XML. Linux has gunzip for that, and on Windows, 7-Zip is the easiest choice. You may need to rename the file extension to .gz for that, so that 7-Zip knows what to do, and you may also need to rename the extracted file’s extension from .gramps to .xml, so that you can use the associated viewer. That is not always needed on Linux, where many viewers inspect part of the file first, to figure out the best way to open it. And when they can’t, you can always use the file command to figure out the type.

If you try to view the extracted XML with Edge or Firefox, you will often find that they will freeze, because the average tree is much bigger than the average web page. And in those situations, it helps to use a tool like Notepad++ on Windows, or Kate on Linux. Kate was written for the KDE desktop, but she can work on other desktops too, even on Windows:

And since Gramps makes it quite difficult to start more instances, it’s often easier to use another tool to view things, also for markdown.

1 Like

Perhaps I mis-communicated my desired task.

The goal isn’t to manipulate Gramps XML outside the Gramps GUI. Rather, it is to use an .gramps XML file as a temporary file for a Gramplet or plug-in.

Using the Notes Gramplet as an example,


My goal would be to have the Gramplet be smart enough to look at .gramps file in a specific location for a Note object if no Tree was loaded (or if no Note objects exist in the current Tree). It would NOT merge the Note into the active Tree if one was loaded. The external file would just be a Read-Only cache.

(Although, since this particular Gramplet supports highlight & copy text to OS clipboard, you’d be able to Paste the content to a new Note in the tree that is actually loaded.)

Ok, I get it. And I assume that we have the technology, because the import and merge tool seems to be able to load a full tree from a backup file, and present it next to the tree that you have in your database. It’s a specialized tool, and I can appreciate the idea of a viewer that gives you the opportunity to look, and even search, into another tree.

I would probably use that a lot, since I often find myself switching between a couple of trees, just to see whether they have data worth copying. And that’s quite a drag.

And while we’re on it. I’d love to have a search feature too, like the good old Google Desktop, or Copernic Desktop Search, for that matter. I actually have one that includes .gramps files in its indexing, but it doesn’t display them as good as I want.

1 Like

That’s a really sophisticated expansion of the idea since the Gramplet would have to have parallel GUI for navigating an entire Tree… but yes, that kind of viewer could be an eventual evolution. Or a Gramplet that offers a side-by-side merge interface… similar to that of FamilySearch

I’d start out a LOT more primitive. Such as dummy/demo XML data for when the Tree lacks the data to show anything or, more likely, when no database is loaded – to eliminate a lot of error handling overhead.

You could install a second copy of Gramps with a different application name so that you can have both open at once. The key is to change the second copy so that it keeps its data in a different place. See this post. (That’s Mac-specific but I imagine you could do the same on Windows.) I think I had also posted once with more detail about copying and changing the app but I can’t find it just now. Media files are also a consideration.

Use a different theme in each one so you can more easily tell which version you’re looking at!

That’s a good trick. Need to remember that if I ever figure out how to install the development branch.

Although I’ve already spent an inordinate amount of time unsuccessfully searching for the Theme CSS after switching to Linux. Figured that if we can write up some user documentation for where to find the appropriate files on Linux, Windoze and macOS; then we might be able to help CSS artists (some of whom have already expressed an interest) start redecorating Gramps.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.