[xsde-users] ignoring parts of the schema - and referenced schemas

Boris Kolpackov boris at codesynthesis.com
Tue Nov 29 10:17:53 EST 2011

Hi Eric,

Eric Broadbent <Eric.Broadbent at csr.com> writes:

> The problem seems to be that I have not generated parsing code for all the 
> possible schemas that can be referenced via attributes.
> It seems that there can be "optional" elements, which essentially allow 
> namespaces to be extended.
> This looks something like this - appearing in any given element attribute 
> list:
>              xmlns:foo="http://schemas.foo.org/2011/XMLSchema-foo"
>              xmlns:bar="http://schemas.foo.org/2011/XMLSchema-bar"
>              foo:foobar=bar
> where "foobar" is an attribute in the schema XMLSchema-foo, and "bar" is yet
> another namespace represented by another schema.  The use of the "foobar"
> attribute to give meaning to the "bar" namespace is dependent on the ability
> to interpret the semantics of the "foo" schema.
> As far as my application is concerned, I do not need to do anything with
> these attributes or namespaces, and I would like the parser to ignore them.
> However, since this kind of namespace reference is dynamic, perhaps there is
> no opportunity to tell the parser to skip over these attributes - in the
> same way that we can tell it to skip over elements.  Therefore I am not sure
> how to deal with this situation - except to have pre-processed any possible
> "optional" schema beforehand and built parsers for it.
> My question is - is there any way to skip over unknown element attributes 
> like this that are referring to other schemas that I have no handlers for
> (and no need for)?

I am having a hard time understanding how the "extension schemas" are
working in your setup without seeing some concrete examples. Generally,
though, you can skip any valid element or attribute by simply not
providing a parser for it. By valid I mean that it is valid for such
an element/attribute to appear in the content, per the schema.

Normally, schema extensions are arranged using the xsd:any or
xsd:anyAttribute wildcards. By default their content will be ignored
but the namespaces of the elements/attributes will still be checked.

The only way to ignore an invalid element or attribute (i.e., one
that is not allowed by the schema) is to disable validation.


More information about the xsde-users mailing list