axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bhatra, Junaid" <jbha...@rsasecurity.com>
Subject RE: FW: Schema question
Date Mon, 16 Oct 2006 18:07:21 GMT
Yes, like Jeff said, you reference an element using "ref" attribute and
you reference a type (simple/complex) using "type" attribute, so there
is no ambiguity as far as schema parsers are concerned.

You can define global elements, types (simple/complex), attributes and
groups in a schema. Each one of these categories is in its own domain
(or namespace, for lack of a better terminology). So you can use the
same name for an element, type, attribute or group. Simple & Complex
types share the same domain, so you cannot simultaneously use the same
name for a simpleType and complexType.

- Junaid

-----Original Message-----
From: Jeff Greif [mailto:jeff.greif@gmail.com] 
Sent: Monday, October 16, 2006 9:46 AM
To: axis-user@ws.apache.org
Subject: Re: FW: Schema question

A complex type is referenced in schemas using type="ns:my-type-name" 
where ns is a prefix bound to the namespace in which the type is 
designed.  A type and an element may have the same name.  It is not 
possible, I think, for an ambiguity to arise within the XML Schema 
system itself, or in many of the specs which use it, such as WSDL.  You 
can also have attributes and elements with the same name.

However, if you invent an arbitrary attribute that can hold any 
qualified name, such as

   global-attribute-element-or-type-name="ns:some-name"

you'll need some other attribute or element to hold information 
resolving the ambiguity.  The schema parser is not involved in handling 
this, however.  The application must deal with this ambiguity.

Jeff

Kedar, Shahar wrote:
> Ann,
>
> To add to my questions below, how can a schema parser distinguish
> between a reference to an {element} and to a {complexType} if they
have
> the same name? 
>
> Thanks,
> Shahar
>
> -----Original Message-----
> From: Kedar, Shahar [mailto:Shahar.Kedar@softwareag.com] 
> Sent: Monday, October 16, 2006 2:30 PM
> To: axis-user@ws.apache.org
> Subject: RE: Schema question
>
> Hi Ann,
>
> Thanks for the quick answer. Another question:
> The {ref} attribute is used only to refer to a global {element}? Can
it
> be used to refer to a {complexType}? If so, then is it possible to
> define an {element} and a {complexType} with the same name?
>
> Thanks,
> Shahar.
>
> -----Original Message-----
> From: Anne Thomas Manes [mailto:atmanes@gmail.com] 
> Sent: Monday, October 16, 2006 1:25 PM
> To: axis-user@ws.apache.org
> Subject: Re: Schema question
>
> You may define a particular element only once in a schema, so if the
> element is used in multiple places, you must define it as a global and
> reference it from the various types that use it. (Only global elements
> can be referenced.) Or perhaps you want to allow the element to be
> used both as a root element and as a child element in another element.
>
> Here's an example:
>
> <s:element name="foo" type="s:string"/>
> <s:element name="foobar" type="tns:foobarType"/>
> <s:complexType name="foobarType">
>    <s:sequence>
>        <s:element ref="tns:foo"/>
>        <s:element name="bar" type="s:string"/>
>    </s:sequence>
> </s:complexType>
>
> Anne
>
>
> On 10/15/06, Kedar, Shahar <Shahar.Kedar@softwareag.com> wrote:
>   
>>
>>
>> Hi,
>>
>>
>>
>> Can someone explain to me when and where the {ref} attribute should
be
>>     
> used
>   
>> inside an XML schema? Also, is it valid for an {element} to refer to
a
>> different {element} and not a {type}?
>>
>>
>>
>> Thanks,
>>
>> Shahar.
>>     


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message