aspose file tools*
The moose likes Web Services and the fly likes Diff between elemment type and ref attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Diff between elemment type and ref attribute" Watch "Diff between elemment type and ref attribute" New topic
Author

Diff between elemment type and ref attribute

shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
what is diff between element type and ref attribute in xml schema. Please provide example to explain.


SCJP 1.5(97%) My Blog
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
The ref attribute:
There are several constraints related to the ref attribute:
- It must be a qualified name referring to a global element type.
- It cannot be used together with the name attribute.
- Only the minOccurs and maxOccurs attributes may be used in an element in which a ref attribute occurs.

The type attribute in an element refers to a global simple type or complex type.
Best wishes!
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
Thanks for the reply Ivan .
I just want to confirm my understanding derived from your reply.
ref and tyep attribute both serves the same purpose but due to the limitations mentioned by you it's preferable to use type attribute. Is is possible for you to give some example where we can use only one of them? Hope I am not troubling you much
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Diff between elemment type and ref attribute