Declaring Elements

In W3C XML Schema terminology, elements and attributes are declared. Both elements and attributes can occur in an instance document.

Listing 19.1 shows a simple example of an XML instance document. Listing 19.2 shows a W3C XML Schema document against which Listing 19.1 can be validated.

Listing 19.1. BasicDocument.xml: A Short XML Instance Document
<?xml version="1.0"?> 
Some text content. 
Listing 19.2. BasicDocument.xsd: A Schema for Listing 19.1
					<?xml version='1.0'?> 
<xsd:schema xmlns:xsd=""> 
<xsd:element name="basicDocument" type="xsd:string" /> 

The indicative namespace prefix in the W3C XML Schema document is xsd. The namespace declaration ...

Get Sams Teach Yourself XML in 10 Minutes now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.