• 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
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!