在Visual Studio IDE中使用XSD進行XML驗證 - XML Validation with XSD in Visual Studio IDE

問題:

I know I have done this before, but it isn't working today, nor can I find anywhere that explains how to do it. 我知道我以前做過這個,但今天不行,也找不到解釋怎麼做的地方。 It could be my lack of sleep, but I suspect gremlins. 這可能是我的睡眠不足,但我懷疑是小鬼。

I have an XML document and a directory full of XSD's that define it. 我有一個XML文檔和一個充滿XSD的目錄來定義它。 How do I set the Visual IDE up to notify me of validation failures, and then provide an intellisense list of valid tags and attributes in a given context? 如何設置Visual IDE以通知我驗證失敗,然後在給定的上下文中提供有效標籤和屬性的智能感知列表?

What I have tried: 我嘗試過的:

  • I've added the XSD's to the project with the XML document. 我已經使用XML文檔將XSD添加到項目中。
  • I've added the XSD's to the XML Schema list (under XML / Schemas... menu item.) 我已將XSD添加到XML Schema列表中(在XML / Schemas ...菜單項下)。
  • I've even included the schemaLocation and noNamespaceSchemaLocation attributes to the XML document. 我甚至將schemaLocation和noNamespaceSchemaLocation屬性包含在XML文檔中。

Visual Studio still isn't giving up any useful debugging or editing information. Visual Studio仍然沒有放棄任何有用的調試或編輯信息。 I tried both 2010 and 2008 (I've done it before in 2008 I thought) 我試過了2010年和2008年(我在2008年之前就已經做過了)

Update: I had another developer try this and it failed for him too. 更新:我有另一個開發人員嘗試這個,它也失敗了。 He knows he has done it with other XML documents and had it work. 他知道他已經使用其他XML文檔完成了它並使其工作。 I then downloaded Oxygen XML editor and it worked fine on the same XML and XSD files, so the files seem to be fine (or Oxygen is more forgiving / flexible . . . ) 然後我下載了Oxygen XML編輯器,它在相同的XML和XSD文件上運行良好,所以文件看起來很好(或者Oxygen更寬容/更靈活......)


解決方案:

參考: https://stackoom.com/en/question/DGNU
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章