Elements, Attributes and values

XML Attributes

In HTML, attributes provide additional information about elements:

<img src=”computer.gif”>
<a href=”demo.asp”>

Attributes often provide information that is not a part of the data. In the example below, the file type is irrelevant to the data, but can be important to the software that wants to manipulate the element:

<file type=”gif”>computer.gif</file>

Elements

An element describes the data that it contains. Elements can also contain other elements and attributes. For more information, see element.
When an element definition contains additional elements or attributes, it is a complex type. For more information on complex types, see the “Types” section later in this topic.
A basic element definition consists of a name and a data type. The following example shows how to define an element named quantity, with a simple type value of integer.

<xs:element name=”quantity” type=”xs:integer” />

The element classifies the data — in this case as a quantity. The type defines the valid content that the element contains — in this case an integer.
The following example shows a valid instance of XML data that conforms to the quantity element defined in the previous example:

<quantity>63</quantity>

The following example shows an invalid instance of the quantity element:

<quantity>sixty three</quantity>

Share this post
[social_warfare]
Ajax
XSLT

Get industry recognized certification – Contact us

keyboard_arrow_up