Can a single XML schema have multiple targetNameSpaces?
I have a complexType
defined in targetNameSpace
as say "http://xyz.example.com"
and used in many places. Now i want to use it in my newly created 开发者_开发问答XSDs with different namespace say "http://abc.example.com"
.
Can i do this? Or do i have to use the same namespace?
A schema can only have a single target namespace.
As to your specific question, if your complex type were in a different namespace, it would be a different type. It is the combination of name and namespace that makes the type unique, not the definition of it.
You can import the schema that defines this type into other schemas, and you can use that complex type in XML document which contain elements from both schemas. That's the strength of XML Namespaces.
精彩评论