
Use of the -useNSPfx Command Line Switch
Specifying -useNSPfx on the command line when compiling a set of XSD specifications will cause the namespace prefixes to be added to the generated C or C++ names. This will ensure that no naming collisions will occur (this is only true, of course, if the XSD specifications being compiled are valid in their use of namespaces). However, the generated C or C++ names will be longer as they will be of the form <prefix>_<localName> where prefix is the defined namespace prefix and localName is the local name for the item.
One thing to be aware of when using -useNSPfx is that prefixes for a given namespace URI can change across schemas. For this reason, it is recommended that all schemas that make up a project be compiled at once to ensure that the same prefix is used for a given name. This can be done by either including all of the schema filenames to be compiled on the command line at once, or by using the -all switch to instruct the compiler to compile all included and/or imported schemas. The prefix that is used for a given name is the first one encountered during the compilation process. If you know that namespace prefix names are maintained in a consistent manner across schemas (i.e. the same prefix is always used to describe a given URI), then it is OK to compile the schemas individually with this option.
| Copyright © Objective Systems
2002-2005 This document may be distributed in any form, electronic or otherwise, provided that it is distributed in its entirety and that the copyright and this notice are included. |
Objective Systems, Inc. 102 Pickering Way, Suite #506 Exton, Pennsylvania 19341 http://www.obj-sys.com Phone: (484) 875-9841 Toll-free: (877) 307-6855 (US only) Fax: (484) 875-9830 info@obj-sys.com |