开发者

Can a single XML schema have multiple targetNameSpaces?

开发者 https://www.devze.com 2022-12-23 22:27 出处:网络
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 \"h

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号