views:

35

answers:

1

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?

+1  A: 

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.

John Saunders
That's a good advice. will have to try it. So u r saying i should import xyz into some other schema(PQR) and then i can use pqr to get that complexType? ... I think i didn't get the last point correctly.
Webbisshh