Increase Your Productivity
When working with XML in Visual Basic 9, you can enable XML IntelliSense by adding a schema to your project. You can add XML schema sets to your project in three different ways:
- Specify an XML file location
- Specify an URL on the web that returns XML
- Paste or type an XML document directly
In order to add an XML schema to your project follow these steps:
- Download and Install the XML to Schema tool
- Open your project in Visual Studio 2008, select the project, right-click and select “Add” then “New Item...”.
- Scroll down to the “My Templates” section and select the “Xml To Schema” template:
.jpg)
- Name the file and then click “Add”. This will open the XML to Schema tool.
- To infer the schema from an XML file, select “Add from File…” and specify the file location.
- To infer the schema from a resource on the web, select “Add from Web…” and specify the URL to the XML.
- To infer the schema directly from XML contents in the clipboard, select “Add from Web” and paste the XML into the edit box.
.jpg)
- Click OK and the tool will infer schemas from all the XML sources and add the resulting .xsd files to your project.
- If your XML data contains elements or attributes in another namespace that the empty namespace add these namespaces using the “Imports <xmlns” statement, you can now observe how the Xml intellisense suggests the available namespaces from the schemas you added to the project:
.jpg)
- In addition, IntelliSense for XML properties is now available:
.jpg)
Discussion and Support
The XML to Schema tool is an alpha release and thus does not have any official support from Microsoft, however, we would love to hear your feedback about usability and any issues you may encounter in using this tool so we can incorporate this feedback in a possible future release. Please visit the Visual Basic IDE forum to ask questions and provide feedback.