I am working on xml and xsd files in VS 2010 but intellisense isn't working. Intellisense is working for the same files in VS 2008, however.
When I type '<xs:' options like "attribute", "complexType", "simpleType", or "element" do not appear.
Is there some difference between the VS 2008 and VS 2010 that I'm missing?
I add an xsd file to my solution. All the proper namespaces are generated automatically as such:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="XMLSchema2"
targetNamespace="http://tempuri.org/XMLSchema2.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/XMLSchema2.xsd"
xmlns:mstns="http://tempuri.org/XMLSchema2.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
</xs:schema>
The "xsdschema.xsd" is in the "C:\Program Files\Microsoft Visual Studio 10.0\xml\Schemas" directory.
There is a check mark in the "Use" column in the XML Schemas dialog box.
You can access the XML Schema Explorer from a . vb file that has a Visual Basic XML literal associated with an . xsd file. To see the schema set in the XML Schema Explorer, right-click an XML node in an XML literal or an XML namespace import and select the Show in Schema Explorer command.
Reference the XSD schema in the XML document using XML schema instance attributes such as either xsi:schemaLocation or xsi:noNamespaceSchemaLocation. Add the XSD schema file to a schema cache and then connect that cache to the DOM document or SAX reader, prior to loading or parsing the XML document.
In Visual Studio, open the File menu and select New > File. Or, use the Ctrl+N keyboard shortcut. In the New File dialog box, select XML Schema and then select Open. A new file is created.
I discovered what happened. Visual Studio 2010 imported the schemas from Visual Studio 2008. This caused duplication warnings like the one below:
Warning The global attribute 'http://www.w3.org/XML/1998/namespace:lang' has already been declared. C:\Program Files\Microsoft Visual Studio 10.0\xml\Schemas\xml.xsd
In the XML Schemas dialog, I removed the old ones from the schema cache. You'll have to restart Visual Studio.
The intellisense and schema validation will disappear if there are warnings not been resolved; like having duplicate complex types defines in different files withing the same schema namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With