Skip to Content
Special Edition Using XML, Second Edition
book

Special Edition Using XML, Second Edition

by - et al. David Gulbransen
July 2002
Intermediate to advanced
864 pages
22h 32m
English
Que
Content preview from Special Edition Using XML, Second Edition

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

XML Pocket Reference, 3rd Edition

XML Pocket Reference, 3rd Edition

Simon St. Laurent, Michael Fitzgerald
Essential XML: Beyond Markup

Essential XML: Beyond Markup

Don Box, Aaron Skonnard, John Lam

Publisher Resources

ISBN: 078972748XPurchase book