Fixed/default attributes in XSD

I would like to use fixed/default attributes in XSD validation, to “apply” to an xml document fixed attributes only defined in the schema but not in the real xml content.
I see that if I call

xmlSchemaSetValidOptions(ctx, XML_SCHEMA_VAL_VC_I_CREATE);

on the context before the validation I correctly get the fixed/default attributes on the xml DOM, but when I re-save the xml to disk after some modification all the fixed attributes are saved as well…

I am porting an existing Win32 application from MSXML, in that case there is a “specified” property on each attribute (default and fixed attribute have specified=false), and only the really “explicit” attributes are really saved to disk.

It is possible to have this behaviour is some way? Is it by design or a bug?
Thanks!

This is by design but could be considered a bug as well. The underlying issue is tracked here in another context: default attributes from the DTD: xmlns unconditionally applied (#284) · Issues · GNOME / libxml2 · GitLab

Is the root problem the same? That issue is about DTDs and xmlns…
Is there any activity on this?

Yes, it’s a similar issue. See the last comment which proposes to add a “specified” flag.

Feel free to open another issue in the bug tracker. But I can’t make any guarantees if or when this will be fixed.

Ok I opened Fixed/default attributes from XSD are saved as normal attributes (#691) · Issues · GNOME / libxml2 · GitLab