Appendix A: Introduction to XML

407

addresses namespace. The convenience of prefixes is that they help the XML be more readable. In Listing A-2, the address namespace is decorated with the a: prefix, as in <a:address> to indicate that address belongs to the http://somedomain.com/addresses namespace. Without the prefix, you would be forced to write the address element as follows, which is more difficult to read:

< http://somedomain.com/addresses:address> 123 4th St

</ http://somedomain.com/addresses:address>

I added line breaks for readability, but in practice the only part of the data read is the value and not the white space, such as newlines, surrounding it.

The XML Menu

When you open an XML document in VS, you’ll see an XML menu appear with options for running, debugging, and profiling XML Transformation (XSLT) documents and working with schemas. XSLT is used by a running program or utility to change an XML document from one form to another. An XML schema is an XML document that describes the allowable format of another XML document. An XML schema is to an XML document what a SQL table definition is to the data that the table holds. Both XSLT and schemas are outside the scope of this book, but now you know where the tools are in case you need to work with them.

Configuring XML Options

Selecting Tools Options will open the VS Options window. From the Options window, you can select Text Editor XML and configure many options associated with writing XML documents, such as turning on line numbering or specifying tag formatting.

Summary

You should now understand the basics of working with XML in VS. You learned how to create an XML document and what prefixes, elements, attributes, and namespaces are. You also learned how to find the XML options to customize your XML document-editing experience. XML is the foundation upon which XAML and XHTML are based, which is covered in later appendices. This should give you familiarity with the XML that is presented in the chapters of this book.

Page 430
Image 430
Microsoft 9GD00001 manual XML Menu, Configuring XML Options, 407