XML / XSD intellisense在Visual Studio 2010中不起作用

时间:2022-09-06 22:52:01

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.

我正在研究VS 2010中的xml和xsd文件,但intellisense无法正常工作。但是,Intellisense正在为VS 2008中的相同文件工作。

When I type '<xs:' options like "attribute", "complexType", "simpleType", or "element" do not appear.

当我输入“ :”选项时,例如“attribute”,“complextype”,“simpletype”或“element”不会出现。

Is there some difference between the VS 2008 and VS 2010 that I'm missing?

我错过的VS 2008和VS 2010之间有什么区别吗?

I add an xsd file to my solution. All the proper namespaces are generated automatically as such:

我在我的解决方案中添加了一个xsd文件。所有正确的命名空间都是自动生成的:

<?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.

“xsdschema.xsd”位于“C:\ Program Files \ Microsoft Visual Studio 10.0 \ xml \ Schemas”目录中。

There is a check mark in the "Use" column in the XML Schemas dialog box.

XML Schemas对话框的“Use”列中有一个复选标记。

2 个解决方案

#1


10  

I discovered what happened. Visual Studio 2010 imported the schemas from Visual Studio 2008. This caused duplication warnings like the one below:

我发现了发生的事。 Visual Studio 2010从Visual Studio 2008导入了模式。这会导致重复警告,如下所示:

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.

在XML Schemas对话框中,我从架构缓存中删除了旧的。您必须重新启动Visual Studio。

#2


2  

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.

如果没有解决警告,智能感知和模式验证将消失;比如具有重复的复杂类型,在具有相同模式名称空间的不同文件中定义。

#1


10  

I discovered what happened. Visual Studio 2010 imported the schemas from Visual Studio 2008. This caused duplication warnings like the one below:

我发现了发生的事。 Visual Studio 2010从Visual Studio 2008导入了模式。这会导致重复警告,如下所示:

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.

在XML Schemas对话框中,我从架构缓存中删除了旧的。您必须重新启动Visual Studio。

#2


2  

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.

如果没有解决警告,智能感知和模式验证将消失;比如具有重复的复杂类型,在具有相同模式名称空间的不同文件中定义。