Empty Elements

Contact Us or call 1-877-932-8228
Empty Elements

Empty Elements

An empty element is an element that contains no content, but it may have attributes. The HomePage element in the instance document below is an empty element. Below the instance is the snippet from the Author.xsd schema that declares the HomePage element.

Code Sample:

Attributes/Demos/MarkTwain.xml
<?xml version="1.0"?>
<Author xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Author.xsd">
	<Name>
		<FirstName>Mark</FirstName>
		<LastName>Twain</LastName>
	</Name>
	<HomePage URL="http://www.marktwain.com"/>
</Author>

Code Sample:

Attributes/Demos/Author.xsd
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
---- C O D E   O M I T T E D ----

				<xs:element name="HomePage">
					<xs:complexType>
						<xs:attribute name="URL" type="xs:anyURI"/>
					</xs:complexType>
				</xs:element>
---- C O D E   O M I T T E D ----

</xs:schema>
Next