O'Reilly logo

Special Edition Using XML, Second Edition by - et al. David Gulbransen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Attribute Declarations in XML Schemas

Attributes are declared in an XML Schema using an <attribute> element, which has a number of attributes itself. Those attributes are used to place constraints on the properties of the attribute declaration.

The scope of an attribute declaration is determined by its placement within the XML Schema. To declare a global attribute, you would declare the attribute as a child of the <schema> element:

<xs:schema> 
  <xs:attribute name="myAttribute"/>
  <xs:element name="someElement type="xs:string"/>
</xs:schema>

In this example, the myAttribute attribute would be declared globally, because it is the child of the <schema> element, and not an element declaration. This means that the attribute could be referenced by ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required