RubyDubee
RubyDubee

Reputation: 2446

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?

Upvotes: 10

Views: 9928

Answers (1)

John Saunders
John Saunders

Reputation: 161773

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.

Upvotes: 8

Related Questions