Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 5. Creating XML Schemas > Creating Empty Elements

Creating Empty Elements

Empty elements have no content, but they can have attributes—so how do you declare them in XML schema? You do that by declaring a complex type and setting the <xsd:complexType> element's content attribute to "empty".

Here's an example. In this case, I'm going to create a new empty element named <image> that can take three attributes: source, width, and height, like this: <image source="/images/cover.gif" height="256" width=512″ />. I start by declaring this element:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial