Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : XML : Education - Tutorials
XML Schema Infoset Model, Part 2
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
6. Elements and attributes
  


Attribute declarations page 4 of 6


Complex Type definitions contain attributes, which are used by complex elements. Attributes themselves are always declared with a simple type. This means that an element with attributes always has a complex structure.

Attribute declarations can be global, local, or references, and are used for:

  • Local validation of attribute information item values using a simple type definition
  • Specifying default or fixed values for attribute information items
The <attribute> element contains attributes, which are described by XML Schema Part 1: Structures of the standard.

The XML Schema model java interface for a <attribute> is org.eclipse.xsd.XSDAttributeDeclaration and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDAttributeDeclaration().

Attribute use
Local attribute declarations and attribute references can be optional, required, or prohibited by changing the attribute use usage attribute.
If an attribute is local or a reference, it can contain attributes, which are described by http://www.w3.org/TR/xmlschema-1/#cAttributeUse.

Referencing a global attribute ceclaration
If you declare a global attribute declaration, you can reference this attribute in the remainder of the schema using the ref attribute. This is done by calling the following method on the XML Schema model: org.eclipse.xsd.XSDAttributeDeclaration.setResolvedAttributeDeclaration(XSDAttributeDeclaration).

Any attribute
The <anyAttribute> element enables us to extend the XML instance document with attributes not specified by the schema.


Main menuSection menuFeedbackPreviousNext
About IBM | Privacy | Legal | Contact