File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Product and Other Certifications and the fly likes What is the benefit of using 'anyAttribute' element. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "What is the benefit of using Watch "What is the benefit of using New topic

What is the benefit of using 'anyAttribute' element.

kumari Jain
Ranch Hand

Joined: Jul 28, 2004
Posts: 44
Consider the following complexType ,which contains simple content and <anyAttribute> element

<xsd:complexType name="salaryType">
<xsd:extension base="xsd:float">
<xsd:anyAttribute processContents="lax" namespace="##other" />

Even if <anyAttribute> was not specified,i can extend the the above complexType to add new attributes from a different namespace in future.

So what is the significance of <anyAttribute> since i'm able to add new attributes to existing complexTypes which do not contain <anyAttribute> mentioned?
Ernesto Elias-Nieland
Ranch Hand

Joined: Sep 01, 2005
Posts: 53


The xs:anyAttribute element specifies that any attribute of one ore more namespaces may appear inside the element. So it may appear inside the xml element. Without the anyAttribute element the xml element must not have any attribute.


0x2B | ~0x2B
SCJD, SCJP 1.5, SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJA, IBM Test 150, 142, 700, 701, Oracle Test 1Z0-51
I agree. Here's the link:
subject: What is the benefit of using 'anyAttribute' element.
It's not a secret anymore!