[QGIS-Developer] QGIS project XSD

G. Allegri giohappy at gmail.com
Fri Jun 30 03:04:48 PDT 2017

(I havent followed the work on QVariantMaps, I will give it a look).

Nyall, I know that to make it error free and mantainable, we will need some
sort of metadata, which would require some work both to set it up and
mantain it.
This dicussion starts from the benfits of having a schema. If the most of
you don't consider it a valuable option, there's no need to dicuss possible
implementation :)

I have various cases where I need to parse a project but I can't rely on
QGIS libs (because of the system environment).

If I had to decide for a solution I would considera, as said before, some
kind of metadata system, even something similar to doctests/docstrings
(skipped by compilers) where every class partecipating (or willing to
partecipate) to the serialization will declare it's sub-schema, and where
it would put it (we are always in an infoset model, so it must declare it's

A utility tool could parse the code and build the final, complete, scheme.
This utility could build whatever kind of scheme (XSD, DTD, our own
selfdescribing format).

Yes, this is an overhead for those working on the parts of the code that
serialize to project, but I don't think this is so big compared to the
For sure we can't mantain a schema manually!


2017-06-30 11:46 GMT+02:00 Nyall Dawson <nyall.dawson at gmail.com>:

> On 30 June 2017 at 19:44, Matthias Kuhn 🌍 <matthias at opengis.ch> wrote:
> > On 06/30/2017 11:32 AM, G. Allegri wrote:
> >>     Normally you start with a schema, and from that create xml. To me it
> >>     sounds pretty hard to keep a schema updated the other way around?
> As the
> >>     api can always add new/changed parts of xml in it?
> >>
> >>
> >> Even QgsProject won't know if a project is valid until all the delegated
> >> classes have tried to deserialize their own parts.
> >
> > Are you aware of real-world problems that were caused by this?
> >
> >>
> >> I think this is a weak point in QGIS, and it doesn't depend on the
> >> serialization format obviously.
> >
> > I think it's only XML that comes with all these metadescription systems
> > like DTD and XSD. I haven't seen anything similar for yaml and json.
> Also, on a related note - I'd prefer to see more areas of code move to
> the approach of serializing/deserialising to QVariantMaps and using
> your recent work on auto converting the maps to XML. It's much less
> maintenance this way :)
> Nyall
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170630/6b706efd/attachment.html>

More information about the QGIS-Developer mailing list