The -noxmlns
option reduces the amount of
code and the size of generated data structures by removing most
support for XML namespaces. Using -noxmlns
changes the code in two ways:
Generated data structures don't have fields for namespace declarations.
Decoders completely ignore namespaces.
Without fields for namespace declaration data, you can't provide
namespace prefixes & URIs to be encoded with a given value.
When a qualified name is encoded, XBinder will declare the
namespace using a generated prefix or else a prefix it took
from the schema document. If this is unacceptable to you,
then do not use -noxmlns
.
If the decoder ignores namespaces, that means it will
accept invalid XML documents, namely those that use the correct local name
but the wrong namespace for an element or an attribute. If this is
unacceptable to you, then do not use -noxmlns
.
Do not use -noxmlns
if your schema uses namespaces and type
extensions. The decoder would not be able to correctly determine an element's actual
type from its xsi:type attribute in the XML document.
When the decoder ignores namespaces, it cannot distinguish between
items that have the same local name but different namespaces.
This is not a problem if your schema does not use namespaces
or if your schema does use namespaces but either does not
declare duplicate local names or else does not allow for XML
documents in which, in a given context, multiple items of the same
local name (in different namespaces) may appear. If your schema
allows for such competing items, then you cannot successfully use
-noxmlns
.
Note: the compiler will not tell
you if you are using the -noxmlns
option when you
should not.