Jump to content
kam

Can we have multiple target namespaces for an XSD file

Recommended Posts

We have two schema say C_PrimaryInformation.xsd and C_SecondaryInformation.xsd. The namespaces for these files are defined as http://3gpp/ns/comp/C_PrimaryInformation and http://3gpp/ns/comp/C_SecondarInformation with prefixes as ns1 and ns2 respecively. We have an another schema file, C_Information.xsd, with the namespace http://3gpp/ns/comp/C_PrimaryInformation/C_Information with the namespace prefix as ns12. Component NameSpace_Prefix Target NameSpace ========= ================ ================ C_PrimaryInformation.xsd ns1 http://3gpp/ns/comp/C_PrimaryInformation C_SecondaryInformation.xsd ns2 http://3gpp/ns/comp/C_SecondarInformation C_BriefInformation.xsd ns12 http://3gpp/ns/comp/C_PrimaryInformation/C_Information Here C_PrimaryInformation.xsd and C_SecondaryInformation.xsd are two root components and C_BriefInformation.xsd is a sub-component. We need to define C_BriefInformation.xsd as a sub-component of these two root components. If I need to make C_BriefInformation.xsd as a sub-component of these two root components, then can the target namespace for this can be deifned as below. http://3gpp/ns/comp/C_PrimaryInformation/C_Information and http://3gpp/ns/comp/C_SecondaryInformation/C_Information Is it possible to design a schema like this?

Share this post


Link to post
Share on other sites
We need to define C_BriefInformation.xsd as a sub-component of these two root components.
What do you mean by a sub component? When I think of name spaces, I think mathematical set theory. You can have subsets of a set, but what is the point here? Name spaces are primarily used to avoid name conflicts / name collisions and bind resources (URI's (or more generally IRI's)). (My authoritative reference on name spaces is Bjarne Strostrup "The design and evolution of C++ chapter 17.")In shortns1:x + ns1:y generally NE ns2:x + ns2:y generally NE x + y in a fuzzy default name space.In strict mathematical logic, you can not have ambiguities. In fuzzy logic you can. The grass can be both green, yellow and brown. Are you introducing fuzzy logic regarding those namespaces?Use these simple rules when you use name spaces.1. Don't use name spaces if you do not need them.2. Don't use a default name space if you can avoid it. It only introduces confusion and the possibility for fuzzy logic.3. Use unigue name spaces identified by QNames only when you need them.4. Think ahead. Will you need name spaces in the future, then it may save you time to start now. Go to 1 above.P.S. You can have private name spaces. Is that what you think of? Scope is always important in programming. You need to have full control of where you are. Knowing the following may save you hours of problems debugging non functional code. Default name spaces do no affect attributes. Unless explicitly set to a namespace with a prefix, attributes do not belong to any name space. Again, do not use default name spaces.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×