Connecting Tech Pros Worldwide Help | Site Map

Different namespaces in one schema

Newbie
 
Join Date: Nov 2008
Posts: 2
#1: Nov 25 '08
Hey Guys,

I'm not sure if this is valid or not, but I was asked to create a schema which in it has a complex type, this complex type has two or more elements where each one of them has different namespace, some times these different elements have the same name, e.g.

1- <impl:elemx>
<ts1:fault>
<ts2:fault2>
</impl:elemx>

2- <impl:elemx>
<ts1:fault>
<ts2:fault>
</impl:elemx>

are these XMLs are valid? if so, how do I write their xsd schemas

I really need your help
Thanks
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#2: Nov 25 '08

re: Different namespaces in one schema


if your schema does not have to make any restrictions on the (local-) element name, use
Expand|Select|Wrap|Line Numbers
  1. <xs:any namespace="--element-namespace--"/>
for more info on wildcards in XML Schema see W3C Schema Specs.

regards
Newbie
 
Join Date: Nov 2008
Posts: 2
#3: Nov 25 '08

re: Different namespaces in one schema


Thanks Dormilich for your reply, but my schema has to define two elements fault and fault1, which should belong to two different namespaces
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#4: Nov 25 '08

re: Different namespaces in one schema


then use <xs:element>, a complete list of options (incl. targetNamespace) is listed in the above document, chapter 3.3.

do fault and fault1 are bound to a specific namespace or can you use any combination of them as long as the namespace differs? (then you should probably use a group or something like that)

regards
Reply