For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
The XML Editor offers a feature, called XML snippets, that allows you to build XML files more quickly. You can reuse XML snippets by inserting them into your files. You can also generate XML data based on an XML Schema definition language (XSD) schema.
The XML Editor includes many snippets that cover some common tasks. This allows you to create XML files more easily. For example, if you were authoring an XML Schema, using the "Complex Type Sequence Element" and "Simple Type Element" snippets inserts the following XML text to your file. You would then change the
name value to suit your needs.
<xs:element name="name"> <xs:complexType> <xs:sequence> <xs:element name="name"> <xs:simpleType> <xs:restriction base="xs:string"></xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> </xs:element>
You can insert snippets in two ways. The Insert Snippet command inserts the XML snippet at the cursor position. The Surround With command wraps the XML snippet around the selected text. Both commands are available either from the IntelliSense submenu under the Edit menu, or from the editor shortcut menu.
For more information, see How to: Use XML Snippets.
The XML editor also has the ability to generate an XML snippet from an XML Schema. This feature allows you to populate an element with XML elements generated from the schema information for that element.
For more information, see How to: Generate an XML Snippet From an XML Schema.
In addition to the snippets that are included with Windows Server 2008 Visual Studio by default you can also create and use your own XML snippets.
For more information, see How to: Create XML Snippets.