File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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:simpleContent>
<xsd:extension base="xsd:float">
<xsd:anyAttribute processContents="lax" namespace="##other" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>

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

Hi!

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.

Ernie


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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What is the benefit of using 'anyAttribute' element.