Hello all, I have the following example.
For my understanding of
schema, I should have been obliged to use
<
xs:element
ref
="tns:
Customer
"
/> but <
xs:element
name
="
Customer
"
/> is valid.
For me, element name = means I am going to declare the content of
Customer element inline. Here I think I should be obliged to use ref and I is
not the case.
Can someone can enlighten me on tis.
Dominique
xs:schema
xmlns:xs
="
http://www.w3.org/2001/XMLSchema
"
xmlns:tns
="
urn:valtech-com:phonebill
"
targetNamespace
="
urn:valtech-com:phonebill
"
elementFormDefault
="
qualified
"
attributeFormDefault
="
unqualified
">
<
xs:element
name
="
PhoneBill
">
<
xs:complexType
>
<
xs:sequence
>
<!--
with name , the schema is valid
-->
<!--
if ref, i am obliged to use
ref='tns:Customer'
-->
<
xs:element
name
="
Customer
"
/>
</
xs:sequence
>
<
xs:attribute
name
="
id
"
type
="
xs:string
"
use
="
required
"/>
<
xs:attribute
name
="
amount
"
type
="
xs:float
"
use
="
required
"/>
<
xs:attribute
name
="
currency
"
type
="
xs:string
"
use
="
required
"/>
</
xs:complexType
>
</
xs:element
>
<
xs:element
name
="
Customer
">
<
xs:complexType
>
<
xs:attribute
name
="
id
"
type
="
xs:string
"
use
="
required
"/>
<
xs:attribute
name
="
firstName
"
type
="
xs:string
"
use
="
required
"/>
<
xs:attribute
name
="
lastName
"
type
="
xs:string
"
use
="
required
"/>
</
xs:complexType
>
</
xs:element
>
</
xs:schema
>