Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the benefit of using 'anyAttribute' element.

 
kumari Jain
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic