The text editor is equally adept, and just as productive, at editing documents with XML content, including XML schemas. The XML editor is launched whenever you open a file with the .xml
extension inside of Visual Studio. It is also launched for .xsl
files and .config
files and is always available when you use the Open With command in the Solution Explorer against any item in a project.
Because XML documents contain structured content involving the concepts of nodes and tags, attributes, and node containership, the XML editor supports document outlining in a similar fashion to the code editor: you can expand or collapse nodes within the editor to expose or hide a node’s content (see Figure 6.30). And just as with the code editor, syntax checking and IntelliSense are fully supported by the XML editor. The XML editor is aware of the syntactical requirements for the current document and provides appropriate IntelliSense and formatting help where possible.
Using the XML editor, you can also carry out these actions:
Edit XSD schema documents
Generate a schema document from an XML document
Edit XSLT style sheets
Edit Document Type Definition (DTD) documents and XML-Data Reduced (XDR) documents
Insert XML snippets
For a proper treatment of the various editing, validation, and productivity aids available in this editor, see Chapter 7, “Working with Visual Studio’s Productivity Aids.” Here, let’s explore two of the core XML functions: schema generation and EXtensible Stylesheet Language Transformations (XSLT) style sheet editing.