After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 635641 - schema compiler should ignore unknown attributes
schema compiler should ignore unknown attributes
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gsettings
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Allison Karlitskaya (desrt)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-11-23 20:53 UTC by Christian Persch
Modified: 2013-10-28 23:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add flag to ignore unknown attributes in g_markup_collect_attributes (2.05 KB, patch)
2010-11-26 21:53 UTC, Christian Persch
none Details | Review
Ignore unknown attributes when reading the gsetting schema (4.63 KB, patch)
2010-11-26 21:53 UTC, Christian Persch
none Details | Review
glib-compile-schemas: ignore qualified tags/attrs (1.19 KB, patch)
2013-10-28 22:31 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Christian Persch 2010-11-23 20:53:21 UTC
Running

glib-compile-schemas --strict --dry-run --schema-file test.gschema.xml 

on this schema:

<schemalist my:attr="foo">
</schemalist>

gives this error:

test.gschema.xml: Error on line 2 char 1: attribute 'my:attr' invalid for element 'schemalist'.

IMHO, the schema compiler should ignore unknown attributes (esp. those in non-default namespaces). This allows the schema writer to include attributes aimed not at the schema compiler, to re-use the same schema file with other tools.
Comment 1 Christian Dywan 2010-11-24 09:38:55 UTC
What other tools would parse the scheme files?
Comment 2 Christian Persch 2010-11-24 20:40:21 UTC
I'm working on a code generator.

Another reason to ignore unknown attributes is forward compatibility.
Comment 3 Allison Karlitskaya (desrt) 2010-11-24 21:12:47 UTC
note that schema files are GMarkup and not XML, strictly speaking.  one of the simplifications is that GMarkup doesn't grok XML namespaces.

Is your code generator the sort that gives you typesafe accessors for each property?
Comment 4 Christian Persch 2010-11-26 21:53:12 UTC
Created attachment 175326 [details] [review]
Add flag to ignore unknown attributes in g_markup_collect_attributes

Bug #635641.
Comment 5 Christian Persch 2010-11-26 21:53:42 UTC
Created attachment 175327 [details] [review]
Ignore unknown attributes when reading the gsetting schema

For forward compatibility, and compatibility with other tools that want
to process the schema file, ignore unknown attributes.

Bug #635641.
Comment 6 Allison Karlitskaya (desrt) 2010-11-28 02:38:46 UTC
I'd feel a lot better if we were doing this in a way that was actually compatible with XML... I think that implies proper namespace support, and I don't know that we want to go there.
Comment 7 Matthias Clasen 2010-11-28 22:11:00 UTC
I don't think that ignoring unknown attributes is "incompatible with XML" in any way. Nor do I believe that doing it properly implies namespace support.
Comment 8 Christian Persch 2012-08-17 13:47:41 UTC
Comment on attachment 175326 [details] [review]
Add flag to ignore unknown attributes in g_markup_collect_attributes

gmarkup now supports this with the commit from bug 665634.
Comment 9 Allison Karlitskaya (desrt) 2013-10-28 22:31:28 UTC
Created attachment 258358 [details] [review]
glib-compile-schemas: ignore qualified tags/attrs

Ignore qualified (in the XML namespace sense) tags and attributes when
compiling GSettings schemas.

This will allow people to add custom tags and attributes to their schemas
without tripping up the compiler.
Comment 10 Allison Karlitskaya (desrt) 2013-10-28 23:38:57 UTC
Attachment 258358 [details] pushed as 908d7d6 - glib-compile-schemas: ignore qualified tags/attrs