Microsoft 9GD00001 Computer Accessories User Manual


 
404 Microsoft Visual Studio 2010: A Beginner’s Guide
E
xtensible Markup Language (XML) is an open-standards cross-platform way of
specifying documents. At its origins, XML was used to represent data, but it has grown
in use to include user interface technologies and even executable logic. While there are
many practical uses of XML, this book is mostly concerned with explaining how XML is
used for ASP.NET, Silverlight, and Windows Presentation Foundation (WPF), all of which
are discussed in chapters of this book. In each of these scenarios, some specialization of
XML is being used to construct user interfaces. In ASP.NET, you use XML for HTML
(XHTML). Both Silverlight and WPF use XML Application Markup Language (XAML),
pronounced “Zamel.” Before learning about XHTML or XAML, you might want an
introduction or refresher on XML, which is the purpose of this appendix. While this
introduction won’t teach you everything about XML, it will give you the essentials that
can help when seeing how XML is being used.
VS 2010 XML Editor
You can create your own XML documents in VS 2010 with the XML editor. There are a
couple of ways to open a new XML document, within or without a project. Without a project,
select File | New | File and select XML File, and click OK. You can rename the file (for
instance, Customer.xml) when saving. Within a project, right-click the project, select Add |
New Item, select the Data list, select XML File, give the document a name (for instance,
Customer.xml), and click OK. What this gives you is an editor with Intellisense support that is
better than Notepad. Listing A-1 shows an XML document that holds customer data.
Listing A-1 An XML document example
<?xml version="1.0" encoding="utf-8" ?>
<customer id="7">
<name>Joe</name>
<address>123 4th St</address>
</customer>
As you can see in Listing A-1, an XML document is readable text. It contains data, and
the meaning of that data is specific to the applications that need to use it. The following
sections will decipher Listing A-1 and explain what each part of the document means.
XML Prefixes
The top of the document in Listing A-1 contains an XML prefix, repeated here for convenience:
<?xml version="1.0" encoding="utf-8" ?>