[xsd-users] Ignoring unknown elements

Boris Kolpackov boris at codesynthesis.com
Thu Oct 16 07:02:41 EDT 2014


Hi Vladimir,

Vladimir Zykov <vladimir.zykov at ncloudtech.ru> writes:

> Back to the problem. Both these specifications allow extensions to the file
> format and this is true that those extensions elements will be in different
> namespace. However, preprocessing XML DOM will require adding that preprocessing
> code (implying higher maintenance cost)

I realize having us maintain a feature that's made especially for you (and
that nobody else will use) is easier but we don't consider this good
engineering. Plus, the code that removes all elements from a DOM document
that belong to a certain namespace will probably take half a page.


> and will require more processing in runtime.

It is runtime processing one way or the other.


> In order to achieve this we are ready to rewrite our XSD schema files (we do this
> anyway for ODF) and remove from them things that we don't currently support so
> that what was in the specification will become unknown content to the generated
> code. 

> We also remove any derivation (by extension or by restriction) for all
> complex types with complex content (i.e. we copy content from base type
> to the derived type).

This could very well be the reason why you end up with huge libraries.
You are essentially duplicating the same code over and over again
instead of simply reusing the base classes.


> Note to the possible implementation. The mode in which generated code 
> will ignore unknown elements must be turned on with XSD command line
> option and certainly this mode is not compatible with XML Schema files
> in which complex types with complex content use derivation mechanisms.

Which is almost any real-world schema.


> Code generation in this case should fail, I think.

Yes, this will work for your very unique case. What about someone else
who also has derivation? They could reasonably expect to be able to
specify individual types that should have content ignored. The point
I am trying to make is that we don't add features that are only usable
by a single user.

Boris



More information about the xsd-users mailing list